diff --git a/frontend/src/components/Navbar.jsx b/frontend/src/components/Navbar.jsx
index 13ce13f..54dfed2 100644
--- a/frontend/src/components/Navbar.jsx
+++ b/frontend/src/components/Navbar.jsx
@@ -1,15 +1,86 @@
-import React, { useState } from "react";
+import React, { useState, useEffect } from "react";
import Sheet from "react-modal-sheet";
import './style/Navbar.css';
export default function Navbar() {
const [spanStyle, setSpanStyle] = useState({ left: "0px", width: "95px" });
- const widthMapping = [95, 94, 110, 115, 110];
+ const [widthMapping, setWidthMapping] = useState([95, 94, 110, 115, 110]);
+
+ // Handle screen resize and adjust widthMapping based on screen size
+ useEffect(() => {
+ const handleResize = () => {
+ if (window.innerWidth < 640) {
+ // For smaller screens (mobile)
+ setWidthMapping([70, 68, 80, 85, 80]); // Adjust these values as per design
+ } else {
+ // For larger screens (desktop)
+ setWidthMapping([95, 94, 110, 115, 110]);
+ }
+ };
+
+ // Call the function initially
+ handleResize();
+
+ // Listen for window resize
+ window.addEventListener("resize", handleResize);
+
+ // Clean up event listener on unmount
+ return () => window.removeEventListener("resize", handleResize);
+ }, []);
+
const handleHover = (index) => {
- const leftPosition = index === 0 ? 0 : widthMapping.slice(0, index).reduce((a, b) => a + b, 0);
- setSpanStyle({ left: `${leftPosition}px`, width: `${widthMapping[index]}px` });
+ const leftPosition =
+ index === 0 ? 0 : widthMapping.slice(0, index).reduce((a, b) => a + b, 0);
+ setSpanStyle({
+ left: `${leftPosition}px`,
+ width: `${widthMapping[index]}px`,
+ });
};
return (
-