From bda622c1dc0433cd42d3cea2169def1c9bff0420 Mon Sep 17 00:00:00 2001 From: Ken Date: Wed, 13 May 2026 23:16:06 +0700 Subject: [PATCH] feat: add dashboard search filters --- frontend/src/components/Common/Navbar.tsx | 39 ++++++++++++++----- frontend/src/routes/_layout/admin.tsx | 42 +++++++++++++++++--- frontend/src/routes/_layout/items.tsx | 47 +++++++++++++++++++---- 3 files changed, 106 insertions(+), 22 deletions(-) diff --git a/frontend/src/components/Common/Navbar.tsx b/frontend/src/components/Common/Navbar.tsx index edcb3d0..db7bb06 100644 --- a/frontend/src/components/Common/Navbar.tsx +++ b/frontend/src/components/Common/Navbar.tsx @@ -1,27 +1,46 @@ -import { Button, Flex, Icon, useDisclosure } from "@chakra-ui/react" -import { FaPlus } from "react-icons/fa" +import { + Button, + Flex, + Icon, + Input, + InputGroup, + InputLeftElement, + useDisclosure, +} from "@chakra-ui/react" +import { FaPlus, FaSearch } from "react-icons/fa" import AddUser from "../Admin/AddUser" import AddItem from "../Items/AddItem" interface NavbarProps { type: string + searchValue?: string + onSearchChange?: (value: string) => void } -const Navbar = ({ type }: NavbarProps) => { +const Navbar = ({ type, searchValue, onSearchChange }: NavbarProps) => { const addUserModal = useDisclosure() const addItemModal = useDisclosure() + const isSearchable = onSearchChange !== undefined return ( <> - {/* TODO: Complete search functionality */} - {/* - - - - - */} + {isSearchable && ( + + + + + onSearchChange(event.target.value)} + fontSize={{ base: "sm", md: "inherit" }} + borderRadius="8px" + /> + + )}