Skip to content

Commit

Permalink
Merge pull request #12 from Team-inglo/feat/IGW-18/3-navbar
Browse files Browse the repository at this point in the history
Feat/IGW-18/3-navbar 네브바 컴포넌트 작성
  • Loading branch information
hyeona01 authored Oct 21, 2024
2 parents d8ab693 + ff0a640 commit 436fa50
Show file tree
Hide file tree
Showing 9 changed files with 3,144 additions and 396 deletions.
3,469 changes: 3,073 additions & 396 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

Empty file removed src/assets/icons/.gitkeep
Empty file.
3 changes: 3 additions & 0 deletions src/assets/icons/DocumentsIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/icons/HomeIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/NavSearchIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/icons/ProfileIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file removed src/components/Common/.gitkeep
Empty file.
54 changes: 54 additions & 0 deletions src/components/Common/Navbar.tsx
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;
3 changes: 3 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export default {
fontFamily: {
pretendard: ['"Pretendard"', 'sans-serif'],
},
backgroundImage:{
navbarGradient : 'linear-gradient(270deg, #FEFEFE 0.35%, #F4F4F9 175.32%)',
}
},
},
plugins: [require('tailwind-scrollbar-hide')],
Expand Down

0 comments on commit 436fa50

Please sign in to comment.