import type { FC } from 'react'; import { DropdownItem } from 'reactstrap'; import type { DateInterval } from './helpers/dateIntervals'; import { DATE_INTERVALS, rangeOrIntervalToString } from './helpers/dateIntervals'; export interface DateIntervalDropdownProps { active?: DateInterval; allText: string; onChange: (interval: DateInterval) => void; } export const DateIntervalDropdownItems: FC = ({ active, allText, onChange }) => ( <> onChange('all')}> {allText} {DATE_INTERVALS.map( (interval) => ( onChange(interval)}> {rangeOrIntervalToString(interval)} ), )} );