-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from Team-inglo/feat/IGW-18/3-navbar
Feat/IGW-18/3-navbar 네브바 컴포넌트 작성
- Loading branch information
Showing
9 changed files
with
3,144 additions
and
396 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { useLocation, useNavigate } from 'react-router-dom'; | ||
import HomeIcon from '@/assets/icons/HomeIcon.svg?react'; | ||
import SearchIcon from '@/assets/icons/NavSearchIcon.svg?react'; | ||
import DocumentsIcon from '@/assets/icons/DocumentsIcon.svg?react'; | ||
import ProfileIcon from '@/assets/icons/ProfileIcon.svg?react'; | ||
|
||
const Navbar = () => { | ||
const location = useLocation(); | ||
const navigate = useNavigate(); | ||
|
||
const getIconColor = (path: string) => { | ||
return location.pathname === path ? '#1E1926' : '#DCDCDC'; | ||
}; | ||
|
||
const routes = [ | ||
{ | ||
path: '/', | ||
svg: HomeIcon, | ||
}, | ||
{ | ||
path: '/search', | ||
svg: SearchIcon, | ||
}, | ||
{ | ||
path: '/documents', | ||
svg: DocumentsIcon, | ||
}, | ||
{ | ||
path: '/profile', | ||
svg: ProfileIcon, | ||
}, | ||
]; | ||
|
||
return ( | ||
<section className="w-full py-6 px-12 bg-navbarGradient rounded-[2rem]"> | ||
<div className="flex justify-between items-center"> | ||
{routes.map((route, index) => { | ||
const IconComponent = route.svg; | ||
return ( | ||
<button key={index} onClick={() => navigate(route.path)}> | ||
{route.path == '/profile' ? ( | ||
<IconComponent stroke={getIconColor(route.path)} /> | ||
) : ( | ||
<IconComponent fill={getIconColor(route.path)} /> | ||
)} | ||
</button> | ||
); | ||
})} | ||
</div> | ||
</section> | ||
); | ||
}; | ||
|
||
export default Navbar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters