From 7e4694f3856804e351e6321dbc89d2e10135f61b Mon Sep 17 00:00:00 2001 From: Mahyar Khanbolooki Date: Fri, 11 Jul 2025 18:12:16 +0330 Subject: [PATCH] add: shipping dropdown --- src/app/[name]/page.tsx | 16 ++++++++++++++++ src/components/dropdown/MultiOption.tsx | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/app/[name]/page.tsx b/src/app/[name]/page.tsx index 1283401..53bf310 100644 --- a/src/app/[name]/page.tsx +++ b/src/app/[name]/page.tsx @@ -131,6 +131,11 @@ const contents: Array = [ { id: '1', title: 'حیوانی' } ] +const shippings: Array = [ + { id: '0', title: 'ارسال با پیک' }, +] + + const MenuIndex = () => { const [search, setSearch] = useState(""); const [selectedCategory, setSelectedCategory] = useState(0); @@ -138,6 +143,7 @@ const MenuIndex = () => { const [sortingModal, setSortingModal] = useState(false); const [sorting, setSorting] = useState(0); const [selectedContentId, setSelectedContentId] = useState('0'); + const [selectedShippingId, setSelectedShippingId] = useState('0'); const updateSearch = useCallback((e: React.ChangeEvent) => { setSearch(e.target.value); @@ -163,6 +169,10 @@ const MenuIndex = () => { setSelectedContentId(() => contents[index]?.id || contents[0].id); } + const changeSelectedShipping = (e: React.MouseEvent, index: number) => { + setSelectedShippingId(() => contents[index]?.id || contents[0].id); + } + const filteredReceiptItems = useMemo(() => { const lowerSearch = search.toLowerCase(); return foods.filter( @@ -227,6 +237,12 @@ const MenuIndex = () => { options={contents} selectedId={selectedContentId} onSelectionChange={changeSelectedContent} /> +

diff --git a/src/components/dropdown/MultiOption.tsx b/src/components/dropdown/MultiOption.tsx index 55a5c80..d9f3d01 100644 --- a/src/components/dropdown/MultiOption.tsx +++ b/src/components/dropdown/MultiOption.tsx @@ -21,7 +21,7 @@ function MultiOption({ title, options, expanded, selectedId, onSelectionChange, } return ( -
+