Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: #16 공용 Header 컴포넌트 UI 작성 #19

Merged
merged 3 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.51.4",
"react-icons": "^5.2.1",
"react-router-dom": "^6.23.1",
"zustand": "^4.5.2"
},
Expand Down
4 changes: 4 additions & 0 deletions src/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions src/components/common/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Link, NavLink } from 'react-router-dom';
import logo from '@assets/logo.svg';
import { FaUserCircle } from 'react-icons/fa';
import { FiHome } from 'react-icons/fi';

export default function Header() {
// ToDo: 로그인 기능 구현 후, 로그아웃 로직 연결하기
return (
<header className="flex h-header items-center justify-between bg-main px-15">
<div>
<Link to="/" className="hover:brightness-90">
<img className="size-30 select-none" src={logo} alt="GrowUp Logo" />
</Link>
</div>
<nav className="flex items-center">
<div className="text-white">User 님의 Grow Up! 응원합니다.</div>
<NavLink to="/" className="ml-10 hover:brightness-90">
{({ isActive }) => <FiHome className={`size-20 ${isActive ? 'text-selected' : 'text-white'}`} />}
</NavLink>
<NavLink to="/setting/user" className="ml-10 hover:brightness-90">
{({ isActive }) => <FaUserCircle className={`size-20 ${isActive ? 'text-selected' : 'text-white'}`} />}
</NavLink>
<button type="button" className="ml-10 h-20 rounded-md bg-white px-4 tracking-tight hover:brightness-90">
Logout
</button>
</nav>
</header>
);
}
3 changes: 2 additions & 1 deletion src/layouts/DefaultLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Outlet } from 'react-router-dom';
import Header from '@/components/common/Header';

export default function DefaultLayout() {
return (
<>
<h3>Default Layout</h3>
<Header />
<Outlet />
</>
);
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3538,6 +3538,11 @@ react-hook-form@^7.51.4:
resolved "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.51.4.tgz"
integrity sha512-V14i8SEkh+V1gs6YtD0hdHYnoL4tp/HX/A45wWQN15CYr9bFRmmRdYStSO5L65lCCZRF+kYiSKhm9alqbcdiVA==

react-icons@^5.2.1:
version "5.2.1"
resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-5.2.1.tgz#28c2040917b2a2eda639b0f797bff1888e018e4a"
integrity sha512-zdbW5GstTzXaVKvGSyTaBalt7HSfuK5ovrzlpyiWHAFXndXTdd/1hdDHI4xBM1Mn7YriT6aqESucFl9kEXzrdw==

react-is@^16.13.1:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
Expand Down