Skip to content

Commit

Permalink
added a 'Register' button to the navbar and drop-down menu that direc…
Browse files Browse the repository at this point in the history
…tly navigates to the sign-up page, added comments and updated README.md with new screenshots
  • Loading branch information
aadi-joshi committed Jan 2, 2025
1 parent 51804e5 commit 8a27129
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/componets/Navbar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react';
import { Link, useLocation} from 'react-router-dom';
import { Link, useLocation } from 'react-router-dom';
import { useSelector, useDispatch } from 'react-redux';
import { logout } from '../Store/authSlice';
import styled from 'styled-components';
Expand Down Expand Up @@ -256,8 +256,9 @@ function Navbar() {
<><NavLink className={location.pathname === '/login' ? 'active' : ''}
whileHover={{ scale: 1.05 }}>
<Link to="/login">Login</Link>
</NavLink><NavLink className={location.pathname === '/register' ? 'active' : ''}
whileHover={{ scale: 1.05 }}>
</NavLink>
<NavLink className={location.pathname === '/register' ? 'active' : ''}
whileHover={{ scale: 1.05 }}>
<Link to="/register">Register</Link>
</NavLink></>
)}
Expand Down Expand Up @@ -304,18 +305,21 @@ function Navbar() {
<MobileNavLink whileHover={{ scale: 1.02 }}>
<Link to="/cart" onClick={toggleMenu}>Cart</Link>
</MobileNavLink>
<MobileNavLink
whileHover={{ scale: 1.02 }}
<MobileNavLink
whileHover={{ scale: 1.02 }}
onClick={() => { handleLogout(); toggleMenu(); }}
style={{ cursor: 'pointer' }}
>
Logout
</MobileNavLink>
</>
) : (
<MobileNavLink whileHover={{ scale: 1.02 }}>
<><MobileNavLink whileHover={{ scale: 1.02 }}>
<Link to="/login" onClick={toggleMenu}>Login</Link>
</MobileNavLink>
<MobileNavLink whileHover={{ scale: 1.02 }}>
<Link to="/register" onClick={toggleMenu}>Register</Link>
</MobileNavLink></>
)}
</MobileMenu>
)}
Expand Down

0 comments on commit 8a27129

Please sign in to comment.