From 3d0b49ac5e2660d2ad5802de4268302d6595c031 Mon Sep 17 00:00:00 2001 From: Timur Ercan Date: Thu, 23 Feb 2023 14:55:55 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20Filter=20Component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/components/filter.tsx | 265 +++++++++++++++++++++++++++++++++ apps/web/pages/documents.tsx | 2 + 2 files changed, 267 insertions(+) create mode 100644 apps/web/components/filter.tsx diff --git a/apps/web/components/filter.tsx b/apps/web/components/filter.tsx new file mode 100644 index 000000000..bed25decb --- /dev/null +++ b/apps/web/components/filter.tsx @@ -0,0 +1,265 @@ +import { Fragment, useState } from "react"; +import { + Dialog, + Disclosure, + Menu, + Popover, + Transition, +} from "@headlessui/react"; +import { XMarkIcon } from "@heroicons/react/24/outline"; +import { ChevronDownIcon } from "@heroicons/react/20/solid"; +import { classNames } from "@documenso/lib"; + +const sortOptions = [ + { name: "Most Popular", href: "#" }, + { name: "Best Rating", href: "#" }, + { name: "Newest", href: "#" }, +]; +const filters = [ + { + id: "status", + name: "Status", + options: [ + { value: "draft", label: "Draft" }, + { value: "pending", label: "Pending" }, + { value: "comppleted", label: "Comppleted" }, + ], + }, +]; + +export default function Example() { + const [open, setOpen] = useState(false); + + return ( +
+ {/* Mobile filter dialog */} + + + +
+ + +
+ + +
+

Filters

+ +
+ + {/* Filters */} +
+ {filters.map((section) => ( + + {({ open }) => ( + <> +

+ + + {section.name} + + + + +

+ +
+ {section.options.map((option, optionIdx) => ( +
+ + +
+ ))} +
+
+ + )} +
+ ))} +
+
+
+
+
+
+ +
+
+

+ New Arrivals +

+

+ Thoughtfully designed objects for the workspace, home, and travel. +

+
+ +
+

+ Product filters +

+ +
+ +
+ + Sort + +
+ + + +
+ {sortOptions.map((option) => ( + + {({ active }) => ( + + {option.name} + + )} + + ))} +
+
+
+
+ + + + + {filters.map((section, sectionIdx) => ( + +
+ + {section.name} + {sectionIdx === 0 ? ( + + 1 + + ) : null} + +
+ + + +
+ {section.options.map((option, optionIdx) => ( +
+ + +
+ ))} +
+
+
+
+ ))} +
+
+
+
+
+ ); +} diff --git a/apps/web/pages/documents.tsx b/apps/web/pages/documents.tsx index 6b3d395e9..91fc7e153 100644 --- a/apps/web/pages/documents.tsx +++ b/apps/web/pages/documents.tsx @@ -17,6 +17,7 @@ import { uploadDocument } from "@documenso/features"; import { DocumentStatus } from "@prisma/client"; import { Tooltip as ReactTooltip } from "react-tooltip"; import { Button, IconButton } from "@documenso/ui"; +import Filter from "../components/filter"; const DocumentsPage: NextPageWithLayout = (props: any) => { const router = useRouter(); @@ -87,6 +88,7 @@ const DocumentsPage: NextPageWithLayout = (props: any) => { +