diff --git a/src/components/navbar/Navbar.jsx b/src/components/navbar/Navbar.jsx
index d8ee8d9..2e162ec 100644
--- a/src/components/navbar/Navbar.jsx
+++ b/src/components/navbar/Navbar.jsx
@@ -4,6 +4,7 @@ import {
faBars,
faRandom,
faMagnifyingGlass,
+ faXmark,
} from "@fortawesome/free-solid-svg-icons";
import { useLanguage } from "@/src/context/LanguageContext";
import { Link, useLocation } from "react-router-dom";
@@ -109,10 +110,14 @@ function Navbar() {
diff --git a/src/components/sidebar/Sidebar.css b/src/components/sidebar/Sidebar.css
new file mode 100644
index 0000000..821d010
--- /dev/null
+++ b/src/components/sidebar/Sidebar.css
@@ -0,0 +1,33 @@
+.sidebar {
+ scrollbar-width: thin;
+ scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
+}
+
+.sidebar::-webkit-scrollbar {
+ width: 5px;
+}
+
+.sidebar::-webkit-scrollbar-track {
+ background: transparent;
+}
+
+.sidebar::-webkit-scrollbar-thumb {
+ background-color: rgba(255, 255, 255, 0.2);
+ border-radius: 20px;
+}
+
+body.sidebar-open {
+ overflow: hidden;
+ padding-right: 5px; /* Prevent layout shift when scrollbar disappears */
+ height: 100%;
+ position: fixed;
+ width: 100%;
+}
+
+/* Wrapper to maintain scroll position when sidebar is opened */
+.sidebar-scroll-wrapper {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ overflow-y: auto;
+}
\ No newline at end of file
diff --git a/src/components/sidebar/Sidebar.jsx b/src/components/sidebar/Sidebar.jsx
index 61a61c9..25b0e4c 100644
--- a/src/components/sidebar/Sidebar.jsx
+++ b/src/components/sidebar/Sidebar.jsx
@@ -1,22 +1,42 @@
import { FaChevronLeft } from "react-icons/fa";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faFilm, faRandom } from "@fortawesome/free-solid-svg-icons";
+import { faFilm, faRandom, faHome, faClock, faFire, faTv, faPlay, faCirclePlay, faFilePen, faPaperPlane } from "@fortawesome/free-solid-svg-icons";
import { useLanguage } from "@/src/context/LanguageContext";
-import { useEffect } from "react";
+import { useEffect, useRef } from "react";
import { Link, useLocation } from "react-router-dom";
-import {
- cleanupScrollbar,
- toggleScrollbar,
-} from "@/src/helper/toggleScrollbar";
+import "./Sidebar.css";
+
+const MENU_ITEMS = [
+ { name: "Home", path: "/home", icon: faHome },
+ { name: "Subbed Anime", path: "/subbed-anime", icon: faFilePen },
+ { name: "Dubbed Anime", path: "/dubbed-anime", icon: faPlay },
+ { name: "Most Popular", path: "/most-popular", icon: faFire },
+ { name: "Movies", path: "/movie", icon: faFilm },
+ { name: "TV Series", path: "/tv", icon: faTv },
+ { name: "OVAs", path: "/ova", icon: faCirclePlay },
+ { name: "ONAs", path: "/ona", icon: faPlay },
+ { name: "Specials", path: "/special", icon: faClock },
+ { name: "Join Telegram", path: "https://t.me/zenime_discussion", icon: faPaperPlane },
+];
const Sidebar = ({ isOpen, onClose }) => {
const { language, toggleLanguage } = useLanguage();
const location = useLocation();
+ const scrollPosition = useRef(0);
useEffect(() => {
- toggleScrollbar(isOpen);
+ if (isOpen) {
+ scrollPosition.current = window.pageYOffset;
+ document.body.classList.add('sidebar-open');
+ document.body.style.top = `-${scrollPosition.current}px`;
+ } else {
+ document.body.classList.remove('sidebar-open');
+ document.body.style.top = '';
+ window.scrollTo(0, scrollPosition.current);
+ }
return () => {
- cleanupScrollbar();
+ document.body.classList.remove('sidebar-open');
+ document.body.style.top = '';
};
}, [isOpen]);
@@ -28,110 +48,83 @@ const Sidebar = ({ isOpen, onClose }) => {
<>
{isOpen && (
)}
-
+ {/* Header */}
+
-
- {[
- { icon: faRandom, label: "Random" },
- { icon: faFilm, label: "Movie" },
- ].map((item, index) => (
+
+ {/* Quick Actions */}
+
+
-
-
- {item.label}
-
+
+
Random
- ))}
-
-
- {["EN", "JP"].map((lang, index) => (
-
- ))}
-
-
-
- Anime name
-
+
+
+
Movie
+
+
+
+ {["EN", "JP"].map((lang, index) => (
+
+ ))}
+
+
Language
-
- {[
- { name: "Home", path: "/home" },
- { name: "Subbed Anime", path: "/subbed-anime" },
- { name: "Dubbed Anime", path: "/dubbed-anime" },
- { name: "Most Popular", path: "/most-popular" },
- { name: "Movies", path: "/movie" },
- { name: "TV Series", path: "/tv" },
- { name: "OVAs", path: "/ova" },
- { name: "ONAs", path: "/ona" },
- { name: "Specials", path: "/special" },
- {
- name: "Join Telegram",
- path: "https://t.me/zenime_discussion",
- },
- ].map((item, index) => (
- -
+ {MENU_ITEMS.map((item, index) => (
+
-
- {item.name}
-
-
+
+ {item.name}
+
))}
-
+
>