From 93fdcdef84ccb2a55b8e94a740c471ad3a7fb25c Mon Sep 17 00:00:00 2001 From: Leo Singer Date: Mon, 2 Oct 2023 13:30:43 -0400 Subject: [PATCH] Add button to expand filter by date menu --- app/routes/circulars._index.tsx | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/app/routes/circulars._index.tsx b/app/routes/circulars._index.tsx index 9fdfd5790..068041bdf 100644 --- a/app/routes/circulars._index.tsx +++ b/app/routes/circulars._index.tsx @@ -36,6 +36,7 @@ import type { action } from './circulars/route' import { Anchor } from '~/components/Anchor' import Hint from '~/components/Hint' import { usePagination } from '~/lib/pagination' +import { useFeature } from '~/root' import searchImg from 'nasawds/src/img/usa-icons-bg/search--white.svg' @@ -249,9 +250,55 @@ function DownloadModal() { ) } +const dateSelectorLabels: Record = { + hour: 'Last hour', + day: 'Last day', + week: 'Last week', + month: 'Last month', + year: 'Last year', + today: 'Today', + mtd: 'Month to date', + ytd: 'Year to date', +} + +function DateSelectorButton({ + startDate, + endDate, + expanded, +}: { + startDate?: string + endDate?: string + expanded?: boolean +}) { + const slimClasses = 'height-4 padding-y-0' + + return ( + + + + + ) +} + export default function () { const newItem = useActionData() const { items, page, totalPages, totalItems } = useLoaderData() + const featureCircularsFilterByDate = useFeature('CIRCULARS_FILTER_BY_DATE') // Concatenate items from the action and loader functions const allItems = [...(newItem ? [newItem] : []), ...(items || [])] @@ -317,6 +364,9 @@ export default function () { /> + {featureCircularsFilterByDate && ( + + )}