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: 메인 페이지 header, navigator 구현 #6

Merged
merged 4 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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 src/App.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions src/assets/images/arrow/down-arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/assets/images/logo/logo-header.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: 0 additions & 4 deletions src/assets/images/nav/down-load-active.svg

This file was deleted.

4 changes: 0 additions & 4 deletions src/assets/images/nav/down-load-inactive.svg

This file was deleted.

6 changes: 3 additions & 3 deletions src/assets/images/nav/my-board-active.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/assets/images/nav/my-board-inactive.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions src/assets/images/nav/record-script-active.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions src/assets/images/nav/record-script-inactive.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/assets/images/nav/test-make-active.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/assets/images/nav/test-make-inactive.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/assets/images/nav/time-table-active.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: 2 additions & 2 deletions src/assets/images/nav/time-table-inactive.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/images/search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/components/HomeLayout/HomeLayout.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@import '../../styles/variables/colors.scss';
@import '../../styles/variables/fonts.scss';

.mainContainer {
display: flex;
margin-top: 80px;
}
14 changes: 10 additions & 4 deletions src/components/HomeLayout/HomeLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { Outlet } from 'react-router-dom';
import MainHeader from '../headers/MainHeader/MainHeader';
import styles from './HomeLayout.module.scss';
import MainNav from '../navigators/MainNav/MainNav';

const HomeLayout = () => {
return (
<div>
HomeLayout
<Outlet />
</div>
<>
<MainHeader />
<main className={styles.mainContainer}>
<MainNav />
<Outlet />
</main>
</>
);
};

Expand Down
15 changes: 15 additions & 0 deletions src/components/common/buttons/TabLink/TabLink.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@import '../../../../styles/variables/colors.scss';
@import '../../../../styles/variables/fonts.scss';

.navItem {
display: flex;
align-items: center;
gap: 10px;
@include SemiBold;
font-size: 18px;
color: $light-gray_81;
text-decoration: none;
&.active {
color: $dark-orange_E5;
}
}
25 changes: 25 additions & 0 deletions src/components/common/buttons/TabLink/TabLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Link, useLocation } from 'react-router-dom';
import styles from './TabLink.module.scss';

interface IProps {
to: string;
activeIcon: React.ReactNode;
inactiveIcon: React.ReactNode;
children: React.ReactNode;
}

const TabLink = ({ to, activeIcon, inactiveIcon, children }: IProps) => {
const location = useLocation();
const isActive = location.pathname === to;
return (
<Link
to={to}
className={`${styles.navItem} ${isActive ? styles.active : ''}`}
>
{isActive ? activeIcon : inactiveIcon}
<span>{children}</span>
</Link>
);
};

export default TabLink;
33 changes: 33 additions & 0 deletions src/components/headers/MainHeader/MainHeader.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@import '../../../styles/variables/colors.scss';
@import '../../../styles/variables/fonts.scss';

.wrapper {
display: flex;
justify-content: space-between;
align-items: center;
position: fixed;
top: 0;
width: 100dvw;
height: 80px;
padding: 20px 10px;
background-color: white;
}

.dropDownsContainer {
display: flex;
justify-content: space-between;
align-items: center;
gap: 20px;
height: 100%;
.dropDownBtn {
display: flex;
justify-content: center;
align-items: center;
gap: 10px;
height: 100%;
background-color: white;
border: none;
cursor: pointer;
@include Regular;
}
}
23 changes: 23 additions & 0 deletions src/components/headers/MainHeader/MainHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import styles from './MainHeader.module.scss';
import Logo from '../../../assets/images/logo/logo-header.svg?react';
import DownArrow from '../../../assets/images/arrow/down-arrow.svg?react';

const MainHeader = () => {
return (
<header className={styles.wrapper}>
<Logo />
<div className={styles.dropDownsContainer}>
<button className={styles.dropDownBtn}>
이용 문의
<DownArrow />
</button>
<button className={styles.dropDownBtn}>
마이페이지
<DownArrow />
</button>
</div>
</header>
);
};

export default MainHeader;
33 changes: 33 additions & 0 deletions src/components/navigators/MainNav/MainNav.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@import '../../../styles/variables/colors.scss';
@import '../../../styles/variables/fonts.scss';

.container {
display: flex;
flex-direction: column;
gap: 20px;
width: 250px;
padding: 20px;
padding-top: 20px;
}
.searchBar {
display: flex;
height: 36px;
padding: 10px;
padding-left: 35px;
background-color: $light-bg_F9;
border: none;
border-radius: 6px;
@include Regular;
color: $light-gray_81;
}
.searchIcon {
position: relative;
bottom: -46px;
left: 15px;
}
.linksContainer {
display: flex;
flex-direction: column;
gap: 20px;
padding: 0 10px;
}
Loading