shlink-web-client/shlink-web-component/utils/dates/DateIntervalSelector.tsx

12 lines
594 B
TypeScript
Raw Normal View History

import type { FC } from 'react';
2023-07-31 22:36:44 +03:00
import { DropdownBtn } from '../../../shlink-frontend-kit/src';
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>
);