From 40004b50b3fe99104646680ed11a4e835b877d3e Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Wed, 3 Sep 2025 16:06:41 +0330 Subject: [PATCH] base compare --- src/app/compare/page.tsx | 86 +++++++++++++++++++++++++++++++++++ src/app/globals.css | 11 +++++ src/share/Header.tsx | 2 +- src/share/components/Menu.tsx | 17 ++++++- 4 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 src/app/compare/page.tsx diff --git a/src/app/compare/page.tsx b/src/app/compare/page.tsx new file mode 100644 index 0000000..3976dcf --- /dev/null +++ b/src/app/compare/page.tsx @@ -0,0 +1,86 @@ +import { Button } from '@/components/ui/button' +import { Separator } from '@/components/ui/separator' +import Layout from '@/hoc/Layout' +import { NextPage } from 'next' +import Image from 'next/image' + +const ComparePage: NextPage = () => { + return ( + +
+
+
+ compare + +
+ رومیزی سندس کد T-2112 طرح فرش +
+ +
+ 260,000 تومان +
+ +
+ +
+
+
+ compare + +
+ رومیزی سندس کد T-2112 طرح فرش +
+ +
+ 260,000 تومان +
+ +
+ +
+
+
+ +
+
+ مشخصات +
+
+ +
+
وزن
+ +
+
+ 350 g +
+
+ + 350 g +
+
+
+
+
+ ) +} + +export default ComparePage \ No newline at end of file diff --git a/src/app/globals.css b/src/app/globals.css index ba5da47..b3c72ba 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -11,6 +11,17 @@ body { max-width: 100vw; } +/* اجازه نمایش منو در دسکتاپ */ +@media (min-width: 768px) { + html { + overflow-x: auto; + } + + body { + overflow-x: auto; + } +} + /* اطمینان از عدم overflow در container ها */ .container, .max-w-full { diff --git a/src/share/Header.tsx b/src/share/Header.tsx index 234066e..eb5cdfe 100644 --- a/src/share/Header.tsx +++ b/src/share/Header.tsx @@ -10,7 +10,7 @@ const Header: FC = () => { return ( -
+
{/* بخش بالایی هدر */}
{/* منوی همبرگری موبایل */} diff --git a/src/share/components/Menu.tsx b/src/share/components/Menu.tsx index ae8256a..e0bef72 100644 --- a/src/share/components/Menu.tsx +++ b/src/share/components/Menu.tsx @@ -9,6 +9,7 @@ import { Category } from '../types/SharedTypes' const Menu: FC = () => { const [isOpen, setIsOpen] = useState(false) const [hoveredPath, setHoveredPath] = useState([]) + const [menuPosition, setMenuPosition] = useState({ top: 0, right: 0 }) const { data, isLoading } = useGetCategories() const menuRef = useRef(null) const router = useRouter() @@ -25,6 +26,16 @@ const Menu: FC = () => { return () => document.removeEventListener('mousedown', handleClickOutside) }, []) + useEffect(() => { + if (isOpen && menuRef.current) { + const rect = menuRef.current.getBoundingClientRect() + setMenuPosition({ + top: rect.bottom + window.scrollY + 8, + right: window.innerWidth - rect.right - window.scrollX + }) + } + }, [isOpen]) + const parentCategories = data?.results?.data?.filter(cat => !cat.parent) || [] const handleCategoryHover = (category: Category, level: number) => { @@ -86,7 +97,11 @@ const Menu: FC = () => { {isOpen && (
{ setIsOpen(false) setHoveredPath([])