mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-11 18:57:31 +03:00
20 lines
621 B
TypeScript
20 lines
621 B
TypeScript
import { DropdownItem } from 'reactstrap';
|
|
import { FC } from 'react';
|
|
import { DATE_INTERVALS, DateInterval, rangeOrIntervalToString } from './types';
|
|
|
|
export interface DateIntervalDropdownProps {
|
|
active?: DateInterval;
|
|
onChange: (interval: DateInterval) => void;
|
|
}
|
|
|
|
export const DateIntervalDropdownItems: FC<DateIntervalDropdownProps> = ({ active, onChange }) => (
|
|
<>
|
|
{DATE_INTERVALS.map(
|
|
(interval) => (
|
|
<DropdownItem key={interval} active={active === interval} onClick={() => onChange(interval)}>
|
|
{rangeOrIntervalToString(interval)}
|
|
</DropdownItem>
|
|
),
|
|
)}
|
|
</>
|
|
);
|