Skip to content

Commit 9bcf599

Browse files
authored
Merge pull request #195 from Podo-Store/feat/convert-size-of-nav-to-fixed
Feat/convert size of nav to fixed
2 parents ac2a80b + b0ff562 commit 9bcf599

File tree

9 files changed

+120
-74
lines changed

9 files changed

+120
-74
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@use "./../_mixins.scss" as m;
2+
3+
.__round-btn__#white {
4+
@include m.white-btn;
5+
6+
border: 2.5px solid var(--Main, #6a39c0);
7+
color: var(--Main, #6a39c0);
8+
}
9+
10+
.__round-btn__#grey {
11+
border: none;
12+
background: #d9d9d9;
13+
color: #fff;
14+
}
15+
16+
.__round-btn__#purple {
17+
@include m.purple-btn;
18+
19+
border: none;
20+
background: var(--Main, #6a39c0);
21+
color: #fff;
22+
}
23+
24+
.__round-btn__#purple:disabled {
25+
background-color: #dadada;
26+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@layer components {
2+
.__round-btn__ {
3+
@apply flex justify-center items-center w-[195px] h-[48px] border-box rounded-[50px] cursor-pointer disabled:cursor-default;
4+
}
5+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import clsx from "clsx";
2+
3+
import { RoundBtnV2Props } from "./types/roundBtnV2Props";
4+
5+
import "./RoundBtnV2.scss";
6+
7+
/**
8+
* button component
9+
*
10+
* className이나 style에 폰트 적용 필요. e.g. p-large-bold
11+
*
12+
* 기본 크기: 195px x 48px
13+
* @param color - "white" | "grey" | "purple"(default)
14+
*/
15+
const RoundBtnV2: React.FC<RoundBtnV2Props> = ({ color = "purple", className, ...props }) => {
16+
const baseClass = "__round-btn__";
17+
18+
return <button className={clsx(className, baseClass)} id={color} {...props}></button>;
19+
};
20+
21+
export default RoundBtnV2;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import RoundBtnV2 from "./RoundBtnV2";
2+
3+
import { RoundBtnV2Props } from "./types/roundBtnV2Props";
4+
5+
/**
6+
* p-large-bold button component
7+
* @param color - "white" | "grey" | "purple"
8+
*/
9+
const RoundBtnV2LargeBold: React.FC<RoundBtnV2Props> = ({ color, className, ...props }) => {
10+
return <RoundBtnV2 color={color} className={"p-large-bold " + className} {...props} />;
11+
};
12+
13+
export default RoundBtnV2LargeBold;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import RoundBtnV2 from "./RoundBtnV2";
2+
3+
import { RoundBtnV2Props } from "./types/roundBtnV2Props";
4+
5+
/**
6+
* p-xs-bold button component
7+
* @param color - "white" | "grey" | "purple"
8+
*/
9+
const RoundBtnV2XsBold: React.FC<RoundBtnV2Props> = ({ color, className, ...props }) => {
10+
return <RoundBtnV2 color={color} className={"p-xs-bold " + className} {...props} />;
11+
};
12+
13+
export default RoundBtnV2XsBold;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface RoundBtnV2Props extends React.ButtonHTMLAttributes<HTMLButtonElement> {
2+
color: "white" | "grey" | "purple";
3+
}

src/pages/MainNav.jsx

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useContext, useState } from "react";
22
import { Link, useLocation, useNavigate } from "react-router-dom";
33

44
import ImageBtn from "@/components/button/ImageBtn";
5+
import RoundBtnV2 from "@/components/button/round_btn/RoundBtnV2";
56
import SideMenuDialog from "@/components/navBar/SideMenuDialog";
67

78
import AuthContext from "../contexts/AuthContext";
@@ -30,9 +31,7 @@ function MainNav() {
3031

3132
return (
3233
<>
33-
{openDialog && (
34-
<SideMenuDialog open={openDialog} onClose={onCloseDialog} />
35-
)}
34+
{openDialog && <SideMenuDialog open={openDialog} onClose={onCloseDialog} />}
3635
<nav className="navbar">
3736
<ImageBtn
3837
className="hamburger-btn"
@@ -49,23 +48,14 @@ function MainNav() {
4948
navigateWithRefresh(event, "/");
5049
}}
5150
>
52-
<img
53-
className="icon"
54-
src={navLogo}
55-
alt="logo"
56-
style={{ height: "2.786vh" }}
57-
/>
58-
<img
59-
src={navTitle}
60-
alt="포도상점"
61-
style={{ height: "2.593vh" }}
62-
></img>
51+
<img className="icon h-[30.086px]" src={navLogo} alt="logo" />
52+
<img src={navTitle} alt="포도상점" className="h-[28px]"></img>
6353
</Link>
6454
<ul className="navbar_menu">
6555
<li>
6656
<Link
6757
to="/list"
68-
className="li"
58+
className="h5-regular"
6959
onClick={(event) => {
7060
navigateWithRefresh(event, "/list");
7161
}}
@@ -81,7 +71,7 @@ function MainNav() {
8171
<li>
8272
<Link
8373
to="/post"
84-
className="li"
74+
className="h5-regular"
8575
onClick={(event) => {
8676
navigateWithRefresh(event, "/post");
8777
}}
@@ -100,35 +90,36 @@ function MainNav() {
10090
</ul>
10191
{!isAuthenticated ? (
10292
<div className="navbar_login">
103-
<button
93+
<RoundBtnV2
10494
onClick={() => {
10595
navigate("/signin", { state: { from: location } });
10696
}}
107-
className="signin_btn"
97+
className="signin_btn p-large-regular w-[150px] h-[44px] rounded-[30px]"
98+
color="white"
10899
>
109100
로그인
110-
</button>
101+
</RoundBtnV2>
111102
</div>
112103
) : (
113104
<div className="navbar_login">
114105
{/*<img src={cart} alt="cart" />*/}
115-
<img
116-
src={person}
117-
alt="myPage"
106+
<button
118107
onClick={(event) => {
119108
navigateWithRefresh(event, "/mypage/purchased");
120109
}}
121-
/>
122-
<button
110+
>
111+
<img src={person} alt="myPage" className="my-page-button" />
112+
</button>
113+
<RoundBtnV2
123114
onClick={() => {
124-
// context 호출
125115
logout();
126116
navigate("/");
127117
}}
128-
className="signin_btn"
118+
className="signin_btn p-large-regular w-[150px] h-[44px] rounded-[30px]"
119+
color="white"
129120
>
130121
로그아웃
131-
</button>
122+
</RoundBtnV2>
132123
</div>
133124
)}
134125
</nav>

src/pages/MainNav.scss

Lines changed: 11 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@
77
align-items: center;
88

99
padding-left: 88px;
10-
@include r.media-tablet {
11-
padding-left: 44px;
12-
}
13-
& {
14-
padding-right: 44px;
10+
padding-right: 44px;
1511

16-
height: 6.481vh; /* 70px */
17-
background-color: #ffffff;
12+
height: 70px;
13+
background-color: #ffffff;
1814

19-
border-bottom: 1px solid var(--Main, #6a39c0);
15+
border-bottom: 1px solid var(--Main, #6a39c0);
16+
17+
@include r.media-tablet {
18+
padding-left: 44px;
2019
}
2120
}
2221

@@ -75,60 +74,30 @@
7574
padding: 8px 30px;
7675
}
7776

78-
.navbar .navbar_menu .li {
79-
color: #000;
80-
81-
/* H5/Regular */
82-
font-family: "Noto Sans KR";
83-
font-size: 1.852vh;
84-
font-style: normal;
85-
font-weight: 400;
86-
line-height: 2.593vh; /* 140% */
87-
}
88-
8977
.navbar .navbar_login {
9078
display: flex;
9179
align-items: center;
9280

9381
position: relative;
9482
}
9583

96-
.navbar .navbar_login img {
84+
.navbar .navbar_login .my-page-button {
9785
position: absolute;
9886
left: -45px;
9987

100-
width: 2.407vh;
101-
height: 2.593vh;
88+
width: 26px;
89+
height: 28px;
10290

10391
cursor: pointer;
10492

105-
transform: translateX(-100%);
93+
transform: translate(-50%, -50%);
10694
@include r.media-mobile {
10795
position: static;
10896
transform: none;
10997
}
11098
}
11199

112100
.navbar .signin_btn {
113-
@include m.white-btn;
114-
115-
border-radius: 30px;
116-
border: 2.5px solid var(--Main, #6a39c0);
117-
width: 13.889vh;
118-
height: 4.074vh;
119-
background-color: #fdfaff;
120-
121-
cursor: pointer;
122-
123-
color: var(--Main, #6a39c0);
124-
125-
/* Paragraph/Large/Regular */
126-
font-family: "Noto Sans KR";
127-
font-size: 1.667vh;
128-
font-style: normal;
129-
font-weight: 500;
130-
line-height: 2.593vh; /* 155.556% */
131-
132101
@include r.media-tablet {
133102
display: none;
134103
}

src/styles/text.css

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,24 +237,29 @@
237237
color: #000;
238238
}
239239

240-
.c-main {
240+
.c-main,
241+
.text-main {
241242
color: var(--Main, #9e30f4);
242243
}
243244

244-
.c-grey4 {
245+
.c-grey4,
246+
.text-gray4 {
245247
color: var(--grey4, #bababa);
246248
}
247249

248-
.c-grey5 {
250+
.c-grey5,
251+
.text-gray5 {
249252
color: var(--grey5, #9e9e9e);
250253
}
251254

252255
.c-grey,
253-
.c-grey6 {
256+
.c-grey6,
257+
.text-gray6 {
254258
color: var(--grey6, #777);
255259
}
256260

257-
.c-grey7 {
261+
.c-grey7,
262+
.text-gray7 {
258263
color: var(--grey7, #3c3c3c);
259264
}
260265

0 commit comments

Comments
 (0)