2023-07-31 19:10:34 +03:00
|
|
|
import type { FC } from 'react';
|
2023-07-31 22:36:44 +03:00
|
|
|
import { DropdownBtn } from '../../../shlink-frontend-kit/src';
|
2023-07-31 19:10:34 +03:00
|
|
|
import type { DateIntervalDropdownProps } from './DateIntervalDropdownItems';
|
|
|
|
import { DateIntervalDropdownItems } from './DateIntervalDropdownItems';
|
|
|
|
import { rangeOrIntervalToString } from './helpers/dateIntervals';
|
|
|
|
|
|
|
|
export const DateIntervalSelector: FC<DateIntervalDropdownProps> = ({ onChange, active, allText }) => (
|
|
|
|
<DropdownBtn text={rangeOrIntervalToString(active) ?? allText}>
|
|
|
|
<DateIntervalDropdownItems allText={allText} active={active} onChange={onChange} />
|
|
|
|
</DropdownBtn>
|
|
|
|
);
|