diff --git a/components/Checkbox.tsx b/components/Checkbox.tsx new file mode 100644 index 0000000..4294d7c --- /dev/null +++ b/components/Checkbox.tsx @@ -0,0 +1,31 @@ +import { faSquare, faSquareCheck } from "@fortawesome/free-regular-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { ChangeEventHandler } from "react"; + +type Props = { + label: string; + state: boolean; + onClick: ChangeEventHandler; +}; + +export default function Checkbox({ label, state, onClick }: Props) { + return ( + + ); +} diff --git a/components/RadioButton.tsx b/components/RadioButton.tsx new file mode 100644 index 0000000..f700033 --- /dev/null +++ b/components/RadioButton.tsx @@ -0,0 +1,32 @@ +import { faCircle, faCircleCheck } from "@fortawesome/free-regular-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { ChangeEventHandler } from "react"; + +type Props = { + label: string; + state: boolean; + onClick: ChangeEventHandler; +}; + +export default function RadioButton({ label, state, onClick }: Props) { + return ( + + ); +} diff --git a/components/Search.tsx b/components/Search.tsx index c2685de..3c5d3d9 100644 --- a/components/Search.tsx +++ b/components/Search.tsx @@ -4,6 +4,7 @@ import { useEffect, useState } from "react"; import ClickAwayHandler from "./ClickAwayHandler"; import useSearchSettingsStore from "@/store/search"; import { useRouter } from "next/router"; +import Checkbox from "./Checkbox"; export default function Search() { const router = useRouter(); @@ -43,64 +44,34 @@ export default function Search() { className="border border-sky-100 rounded-md pr-6 w-60 focus:border-sky-500 sm:focus:w-80 hover:border-sky-500 duration-100 outline-none p-1" /> {searchBox ? ( -
-

Filter by:

-
- - - - - +
+
+

Filter by

+ toggleCheckbox("name")} + /> + toggleCheckbox("url")} + /> + toggleCheckbox("title")} + /> + toggleCheckbox("collection")} + /> + toggleCheckbox("tags")} + />
) : null} diff --git a/pages/collections/index.tsx b/pages/collections/index.tsx index 45dd254..a04b76e 100644 --- a/pages/collections/index.tsx +++ b/pages/collections/index.tsx @@ -7,7 +7,6 @@ import useCollectionStore from "@/store/collections"; import { faAdd, faBox, - faCheck, faEllipsis, faPlus, faSort, @@ -20,6 +19,8 @@ import Modal from "@/components/Modal"; import AddCollection from "@/components/Modal/AddCollection"; import MainLayout from "@/layouts/MainLayout"; import ClickAwayHandler from "@/components/ClickAwayHandler"; +import { faCircle, faCircleCheck } from "@fortawesome/free-regular-svg-icons"; +import RadioButton from "@/components/RadioButton"; export default function () { const { collections } = useCollectionStore(); @@ -32,7 +33,7 @@ export default function () { setCollectionModal(!collectionModal); }; - const [sortBy, setSortBy] = useState(""); + const [sortBy, setSortBy] = useState("Name"); const handleSortChange = (event: ChangeEvent) => { setSortBy(event.target.value); @@ -104,59 +105,27 @@ export default function () { }} className="absolute top-8 right-0 shadow-md bg-gray-50 rounded-md p-2 z-10 border border-sky-100 w-36" > -

Sort by

+

+ Sort by +

- - - + + + + +
) : null}