Skip to content

Commit

Permalink
dark mode is missing Devmangrani#63 Devmangrani#70
Browse files Browse the repository at this point in the history
done changes
  • Loading branch information
its-Pratik-15 authored Oct 29, 2024
1 parent 8cd6f37 commit 502e582
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions components/NavBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export default function NavBar() {
const user = useSelector((state) => state.User.userData);
const [isOpen, setIsOpen] = useState(false);
const [scrolled, isScrolled] = useState(false);
const [isNightMode, setNightMode] = useState(false);

const hamburgerRef = React.useRef(null);

const useOutsideClick = (callback, exceptions) => {
Expand Down Expand Up @@ -76,11 +78,10 @@ export default function NavBar() {
localStorage.removeItem("user");
router.reload();
};

const toggleNightMode = () => {
setNightMode((prevMode) => !prevMode);
};

const handleClickOutside = () => {
setIsOpen(false);
};
Expand Down Expand Up @@ -224,9 +225,10 @@ export default function NavBar() {
>
SIGN IN
</Link>
<button onClick={toggleNightMode} className="ml-4">
{nightMode ? "Switch to Day Mode" : "Switch to Night Mode"}
</button>
<button onClick={toggleNightMode} className={styles.nightModeToggle}>
{isNightMode ? "Day Mode" : "Night Mode"}
</button>

</div>
)}
</div>
Expand Down

0 comments on commit 502e582

Please sign in to comment.