diff --git a/package-lock.json b/package-lock.json
index 0bd4fca..18fa98a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14,7 +14,8 @@
"react-dom": "^19.0.0",
"react-spinners": "^0.15.0",
"swiper": "^11.2.6",
- "tailwind-merge": "^3.0.2"
+ "tailwind-merge": "^3.0.2",
+ "zustand": "^5.0.3"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
@@ -1156,7 +1157,7 @@
"version": "19.0.12",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.0.12.tgz",
"integrity": "sha512-V6Ar115dBDrjbtXSrS+/Oruobc+qVbbUxDFC1RSbRqLt5SYvxxyIDrSC85RWml54g+jfNeEMZhEj7wW07ONQhA==",
- "dev": true,
+ "devOptional": true,
"license": "MIT",
"dependencies": {
"csstype": "^3.0.2"
@@ -2065,7 +2066,7 @@
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
- "dev": true,
+ "devOptional": true,
"license": "MIT"
},
"node_modules/damerau-levenshtein": {
@@ -5742,6 +5743,35 @@
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
+ },
+ "node_modules/zustand": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.3.tgz",
+ "integrity": "sha512-14fwWQtU3pH4dE0dOpdMiWjddcH+QzKIgk1cl8epwSE7yag43k/AD/m4L6+K7DytAOr9gGBe3/EXj9g7cdostg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.20.0"
+ },
+ "peerDependencies": {
+ "@types/react": ">=18.0.0",
+ "immer": ">=9.0.6",
+ "react": ">=18.0.0",
+ "use-sync-external-store": ">=1.2.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "immer": {
+ "optional": true
+ },
+ "react": {
+ "optional": true
+ },
+ "use-sync-external-store": {
+ "optional": true
+ }
+ }
}
}
}
diff --git a/package.json b/package.json
index ca96f53..9c1def1 100644
--- a/package.json
+++ b/package.json
@@ -15,7 +15,8 @@
"react-dom": "^19.0.0",
"react-spinners": "^0.15.0",
"swiper": "^11.2.6",
- "tailwind-merge": "^3.0.2"
+ "tailwind-merge": "^3.0.2",
+ "zustand": "^5.0.3"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 199ce81..cba107c 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -5,6 +5,7 @@ import "./globals.css";
import "@/assets/fonts/irancell/style.css";
import Header from "@/shared/Header";
import Footer from "@/shared/Footer";
+import SideBar from "@/shared/SideBar";
const geistSans = Geist({
variable: "--font-geist-sans",
@@ -32,6 +33,7 @@ export default function RootLayout({
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
+
{children}
diff --git a/src/shared/Header.tsx b/src/shared/Header.tsx
index cbc7dd9..3ec9f25 100644
--- a/src/shared/Header.tsx
+++ b/src/shared/Header.tsx
@@ -1,10 +1,13 @@
+'use client'
import { FC, Fragment } from 'react'
import Image from 'next/image'
import Link from 'next/link'
import { HambergerMenu, Profile, SearchNormal } from 'iconsax-react'
import Button from '@/components/Button'
+import { useSharedStore } from '@/shared/store/sharedStore'
const Header: FC = () => {
+ const { openSidebar, setOpenSidebar } = useSharedStore()
return (
@@ -71,6 +74,7 @@ const Header: FC = () => {
setOpenSidebar(!openSidebar)}
size={24}
color='black'
/>
diff --git a/src/shared/SideBar.tsx b/src/shared/SideBar.tsx
new file mode 100644
index 0000000..186090f
--- /dev/null
+++ b/src/shared/SideBar.tsx
@@ -0,0 +1,101 @@
+'use client'
+import { FC } from 'react'
+import { Building4, CodeCircle, DocumentText, Element3, Element4, Home2, UserSquare } from 'iconsax-react'
+import SideBarItem from './SideBarItem'
+import { useSharedStore } from './store/sharedStore'
+import { clx } from '../helpers/utils'
+import Image from 'next/image'
+import { usePathname } from 'next/navigation'
+
+const SideBar: FC = () => {
+
+ const { openSidebar, setOpenSidebar } = useSharedStore()
+ const pathname = usePathname()
+ const isActive = (name: string) => {
+ if (pathname === '/' && name === 'home') {
+ return true
+ }
+ return pathname.includes(name)
+ }
+
+ const iconSizeSideBar = 20
+
+ return (
+ <>
+ {
+ openSidebar && setOpenSidebar(false)} />
+ }
+
+
+
+
+
+
+
+ منو
+
+
+
+ }
+ title='صفحه اصلی'
+ isActive={isActive('home')}
+ link={'/'}
+ />
+
+ }
+ title={'محصولات'}
+ isActive={isActive('products')}
+ link={'/products'}
+ />
+
+ }
+ title={'خدمات دناک'}
+ isActive={isActive('danak-services')}
+ link={'/danak-services'}
+ />
+
+ }
+ title={'نمایندگان'}
+ isActive={isActive('representatives')}
+ link={'/representatives'}
+ />
+
+ }
+ title={'توسعه دهندگان'}
+ isActive={isActive('developers')}
+ link={'/developers'}
+ />
+
+ }
+ title={'درباره ما'}
+ isActive={isActive('about')}
+ link={'/about'}
+ />
+
+ }
+ title={'بلاگ'}
+ isActive={isActive('blogs')}
+ link={'/blogs'}
+ />
+
+
+
+
+
+ >
+ )
+}
+
+export default SideBar
\ No newline at end of file
diff --git a/src/shared/SideBarItem.tsx b/src/shared/SideBarItem.tsx
new file mode 100644
index 0000000..a7595a4
--- /dev/null
+++ b/src/shared/SideBarItem.tsx
@@ -0,0 +1,46 @@
+import { FC, ReactNode } from 'react'
+import { clx } from '../helpers/utils'
+import Link from 'next/link'
+
+
+type Props = {
+ icon: ReactNode,
+ title: string,
+ isActive: boolean,
+ link: string,
+ isLogout?: boolean,
+ isWithoutLine?: boolean
+}
+
+const SideBarItem: FC
= (props: Props) => {
+
+ // const logout = useLogout()
+
+ const handleLogout = async () => {
+ // await logout.mutateAsync()
+ // removeToken()
+ // removeRefreshToken()
+ // window.location.href = Pages.auth.login
+ }
+
+ return (
+
+ {
+ !props.isWithoutLine &&
+
+ }
+
+ {props.icon}
+
+ {props.title}
+
+
+
+
+ )
+}
+
+export default SideBarItem
\ No newline at end of file
diff --git a/src/shared/store/sharedStore.ts b/src/shared/store/sharedStore.ts
new file mode 100644
index 0000000..731c65a
--- /dev/null
+++ b/src/shared/store/sharedStore.ts
@@ -0,0 +1,7 @@
+import { create } from "zustand";
+import { SharedStoreType } from "../types/SharedTypes";
+
+export const useSharedStore = create((set) => ({
+ openSidebar: false,
+ setOpenSidebar: (value) => set({ openSidebar: value }),
+}));
diff --git a/src/shared/types/SharedTypes.ts b/src/shared/types/SharedTypes.ts
new file mode 100644
index 0000000..b681e51
--- /dev/null
+++ b/src/shared/types/SharedTypes.ts
@@ -0,0 +1,4 @@
+export type SharedStoreType = {
+ openSidebar: boolean;
+ setOpenSidebar: (value: boolean) => void;
+};