2020-09-19 19:35:05 +02:00
|
|
|
import { FormattedMessage } from 'react-intl';
|
2023-01-11 17:33:43 +01:00
|
|
|
import DateFilter from 'components/common/DateFilter';
|
|
|
|
import { Button, Flexbox } from 'react-basics';
|
2020-09-19 19:35:05 +02:00
|
|
|
import useDateRange from 'hooks/useDateRange';
|
|
|
|
import { DEFAULT_DATE_RANGE } from 'lib/constants';
|
|
|
|
|
|
|
|
export default function DateRangeSetting() {
|
|
|
|
const [dateRange, setDateRange] = useDateRange();
|
|
|
|
const { startDate, endDate, value } = dateRange;
|
|
|
|
|
2023-01-11 17:33:43 +01:00
|
|
|
const handleReset = () => setDateRange(DEFAULT_DATE_RANGE);
|
2020-09-19 19:35:05 +02:00
|
|
|
|
|
|
|
return (
|
2023-01-11 17:33:43 +01:00
|
|
|
<Flexbox width={400} gap={10}>
|
|
|
|
<DateFilter value={value} startDate={startDate} endDate={endDate} onChange={setDateRange} />
|
|
|
|
<Button onClick={handleReset}>
|
2020-10-13 07:53:59 +02:00
|
|
|
<FormattedMessage id="label.reset" defaultMessage="Reset" />
|
2020-09-19 19:35:05 +02:00
|
|
|
</Button>
|
2023-01-11 17:33:43 +01:00
|
|
|
</Flexbox>
|
2020-09-19 19:35:05 +02:00
|
|
|
);
|
|
|
|
}
|