diff --git a/src/components/home.jsx b/src/components/home.jsx index 7b121e3c2..7906e720d 100644 --- a/src/components/home.jsx +++ b/src/components/home.jsx @@ -68,14 +68,24 @@ const darkTheme = createTheme({ export default function HomeComponent() { const [darkMode, setDarkMode] = useState(false); // State to toggle theme const theme = darkMode ? darkTheme : lightTheme; - + + React.useEffect(() => { + const savedTheme = localStorage.getItem('theme'); + if (savedTheme) { + setDarkMode(savedTheme === 'dark'); + } + }, []); + const toggleTheme = () => { + const newTheme = !darkMode ? 'dark' : 'light'; setDarkMode(!darkMode); + localStorage.setItem('theme', newTheme); }; + const isMobile = useMediaQuery("(max-width:600px)"); const isTablet = useMediaQuery("(min-width:601px) and (max-width:900px)"); - const isBigTablet = useMediaQuery("(min-width:901px) and (max-width:1280px)"); + const isBigTablet = useMediaQuery("(min-width:901px) and (max-width:1400px)"); const is1024 = useMediaQuery("(width:1024px)"); const is1280 = useMediaQuery("(width:1280px)"); @@ -114,9 +124,15 @@ export default function HomeComponent() { } + icon={} checkedIcon={} - sx={{ marginLeft: "auto", transform: "scale(1.5)" }} + sx={{ marginLeft: "auto", + "& .MuiSwitch-track": { + backgroundColor: darkMode ? "#FFD700" : "#FFD700", // Yellowish color for the track + }, + "& .Mui-checked + .MuiSwitch-track": { + backgroundColor: "#FFD700", // Yellowish color for the track when checked + }, transform: "scale(1.5)" }} /> {/* @@ -128,147 +144,104 @@ export default function HomeComponent() { sx={{ marginBottom: "30px", marginTop: isMobile ? "5vh" : "2vh", - // height: "auto", - marginLeft: is1024 - ? "-5vw" - : is1280 - ? "-5vw" - : isMobile - ? "auto" - : isTablet - ? "-6vw" - : isBigTablet - ? "-6vw" - : "auto", - paddingLeft: isMobile - ? "auto" - : isTablet - ? "auto" - : isBigTablet - ? "auto" - : "5vw", - paddingRight: isMobile - ? "auto" - : isTablet - ? "auto" - : isBigTablet - ? "auto" - : "5vw", - marginRight: isMobile - ? "auto" - : isTablet - ? "5vw" - : isBigTablet - ? "5vw" - : "5vw", + marginLeft: "auto", + marginRight: "auto", + paddingLeft: isMobile ? "auto" : "5vw", + paddingRight: isMobile ? "auto" : "5vw", }} > - - Popular Portals - + + Popular Portals + - - {popularPortals.map((portal, index) => ( - - + {" "} + {/* Centering the grid items */} + {popularPortals.map((portal, index) => ( + - {/* */} - - - {portal.description} - - {/* */} - - - ))} - + + + + {portal.description} + + + + + ))} + + - + {linkCategories.map((category, index) => ( - - - Miscellaneous - - + - {Miscellaneous.map((portal, index) => ( - - + Miscellaneous + + + + {Miscellaneous.map((portal, index) => ( + - - - - {portal.description} - - - - - ))} - + + + + + {portal.description} + + + + + ))} + + +