From 3fe0b1722ec6b5442426f77de8ff8de8175da68c Mon Sep 17 00:00:00 2001 From: artrmkr <64688851+artrmkr@users.noreply.github.com> Date: Fri, 22 May 2026 04:48:35 +0900 Subject: [PATCH] Add search filters to management tables --- frontend/src/components/Common/Navbar.tsx | 47 +++++++++++++++++------ frontend/src/routes/_layout/admin.tsx | 39 ++++++++++++++++--- frontend/src/routes/_layout/items.tsx | 41 ++++++++++++++++---- frontend/src/utils.ts | 21 +++++++++- 4 files changed, 123 insertions(+), 25 deletions(-) diff --git a/frontend/src/components/Common/Navbar.tsx b/frontend/src/components/Common/Navbar.tsx index edcb3d0..a16db1c 100644 --- a/frontend/src/components/Common/Navbar.tsx +++ b/frontend/src/components/Common/Navbar.tsx @@ -1,30 +1,55 @@ -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 { + onSearchChange?: (value: string) => void + searchPlaceholder?: string + searchValue?: string type: string } -const Navbar = ({ type }: NavbarProps) => { +const Navbar = ({ + onSearchChange, + searchPlaceholder, + searchValue = "", + type, +}: NavbarProps) => { const addUserModal = useDisclosure() const addItemModal = useDisclosure() return ( <> - - {/* TODO: Complete search functionality */} - {/* - - - - - */} + + {onSearchChange && ( + + + + + onSearchChange(event.target.value)} + placeholder={searchPlaceholder ?? `Search ${type.toLowerCase()}s`} + fontSize={{ base: "sm", md: "inherit" }} + borderRadius="8px" + /> + + )}