Skip to content

Commit 9cb0098

Browse files
authored
Merge pull request #72 from codeit-maso/feature/Yun
✨ feat: 모달 스크롤바 구현 및 반응형 구현
2 parents 59776b6 + 25048e0 commit 9cb0098

File tree

12 files changed

+208
-37
lines changed

12 files changed

+208
-37
lines changed

src/assets/styles/variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ $surface: #f6f8ff;
4747
$font-size-10: 1rem;
4848
$font-size-12: 1.2rem;
4949
$font-size-14: 1.4rem;
50+
$font-size-15: 1.5rem;
5051
$font-size-16: 1.6rem;
5152
$font-size-18: 1.8rem;
5253
$font-size-20: 2rem;

src/components/Card/Card.jsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ import plus from '../../assets/images/plus.svg';
55
import Badge from '../Badge/Badge';
66
import styles from './Card.module.scss';
77

8+
const fontFamilyMap = {
9+
'Noto Sans': '"Noto Sans", sans-serif',
10+
Pretendard: '"Pretendard", sans-serif',
11+
나눔명조: '"Nanum Myeongjo", serif',
12+
'나눔손글씨 손편지체': '"Nanum Sonpyeonji Ce", cursive',
13+
};
14+
815
export default function Card({
916
id,
1017
image,
@@ -28,15 +35,9 @@ export default function Card({
2835
function clickDelete(e) {
2936
e.stopPropagation();
3037
if (confirm('정말 삭제하시겠어요?')) {
31-
onDelete?.(id);
38+
onDelete?.(id, recipientId);
3239
}
3340
}
34-
const fontFamilyMap = {
35-
'Noto Sans': '"Noto Sans", sans-serif',
36-
Pretendard: '"Pretendard", sans-serif',
37-
나눔명조: '"Nanum Myeongjo", serif',
38-
'나눔손글씨 손편지체': '"Nanum Sonpyeonji Ce", cursive',
39-
};
4041

4142
return (
4243
<article

src/components/Card/Card.module.scss

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,30 @@
9999
color: $gray-400;
100100
}
101101
}
102+
103+
@media (max-width: 1248px) {
104+
.card {
105+
width: inherit;
106+
}
107+
}
108+
109+
@media (max-width: 1024px) {
110+
.card {
111+
height: 284px;
112+
}
113+
}
114+
115+
@media (max-width: 768px) {
116+
.card {
117+
height: 230px;
118+
119+
&__body {
120+
.card__content {
121+
-webkit-line-clamp: 2;
122+
line-clamp: 2;
123+
word-break: break-word;
124+
@include font-15-regular;
125+
}
126+
}
127+
}
128+
}

src/components/Modal/Modal.jsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@ import Badge from '../Badge/Badge';
44
import Button from '../common/Button';
55
import styles from './Modal.module.scss';
66

7+
const fontFamilyMap = {
8+
'Noto Sans': '"Noto Sans", sans-serif',
9+
Pretendard: '"Pretendard", sans-serif',
10+
나눔명조: '"Nanum Myeongjo", serif',
11+
'나눔손글씨 손편지체': '"Nanum Sonpyeonji Ce", cursive',
12+
};
13+
714
export default function Modal({
815
image,
916
sender,
1017
relationship,
1118
children,
19+
font,
1220
createdAt,
1321
onClose,
1422
}) {
@@ -35,7 +43,10 @@ export default function Modal({
3543
</header>
3644
<div className={styles['modal__body']}>
3745
<div className={styles['modal__content']}>
38-
<div dangerouslySetInnerHTML={{ __html: sanitizedHTML }} />
46+
<div
47+
style={{ fontFamily: fontFamilyMap[font] }}
48+
dangerouslySetInnerHTML={{ __html: sanitizedHTML }}
49+
/>
3950
</div>
4051
</div>
4152
<div className={styles['modal__footer']}>

src/components/Modal/Modal.module.scss

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,17 @@
8181
}
8282

8383
&__body {
84-
width: 500px;
8584
height: 240px;
85+
overflow-y: auto;
86+
}
87+
88+
&__body::-webkit-scrollbar {
89+
width: 4px;
90+
}
91+
92+
&__body::-webkit-scrollbar-thumb {
93+
background-color: $gray-300;
94+
border-radius: 4px;
8695
}
8796

8897
&__content {
@@ -100,3 +109,9 @@
100109
align-self: center;
101110
}
102111
}
112+
113+
@media (max-width: 768px) {
114+
.modal {
115+
width: calc(100% - 48px);
116+
}
117+
}

src/components/common/Button.module.scss

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@use '../../assets/styles/variables.scss' as *;
22

33
.button {
4-
max-width: 720px;
54
width: 100%;
65
height: 56px;
76
padding: 14px 24px;
@@ -52,7 +51,7 @@
5251
}
5352

5453
&--delete {
55-
max-width: 92px;
54+
width: inherit;
5655
height: 39px;
5756
padding: 7px 16px;
5857
border-radius: 6px;
@@ -62,15 +61,24 @@
6261
@media (min-width: 768px) and (max-width: 1023px) {
6362
&--primary,
6463
&--delete {
65-
max-width: 720px;
64+
min-width: 720px;
6665
}
6766
}
6867

6968
@media (max-width: 767px) {
7069
&,
7170
&--primary,
7271
&--delete {
73-
max-width: 320px;
72+
min-width: 320px;
73+
}
74+
}
75+
}
76+
77+
@media (max-width: 1024px) {
78+
.button {
79+
&--delete {
80+
width: 100%;
81+
height: 55px;
7482
}
7583
}
7684
}

src/components/common/FormInput.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969

7070
@media (max-width: 767px) {
7171
& {
72-
max-width: 320px;
72+
min-width: 320px;
7373
}
7474
}
7575
}

src/components/layout/Header/Header.jsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Link } from 'react-router-dom';
2-
import { useLocation } from 'react-router-dom';
1+
import { Link, useLocation } from 'react-router-dom';
2+
import { useState, useEffect } from 'react';
33
import styles from './Header.module.scss';
44
import logo from '../../../assets/images/rolling-logo.svg';
55

@@ -9,6 +9,23 @@ export default function Header() {
99
const location = useLocation();
1010
const isLocation = showButton.includes(location.pathname);
1111

12+
const [isMobile, setIsMobile] = useState(false);
13+
14+
useEffect(() => {
15+
function handleResize() {
16+
setIsMobile(window.innerWidth <= 768);
17+
}
18+
19+
handleResize();
20+
window.addEventListener('resize', handleResize);
21+
22+
return () => window.removeEventListener('resize', handleResize);
23+
}, []);
24+
25+
if (isMobile && !isLocation) {
26+
return null;
27+
}
28+
1229
return (
1330
<>
1431
<header className={styles.header}>

src/pages/CreateRecipient/CreateRecipient.jsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,17 @@ export default function CreateRecipient() {
166166
</ul>
167167
)}
168168
</div>
169-
<Button
170-
type="button"
171-
onClick={handleButtonClick}
172-
disabled={!value.trim()}
173-
>
174-
생성하기
175-
</Button>
169+
170+
<div className={styles['create-page__create-button']}>
171+
<Button
172+
type="button"
173+
onClick={handleButtonClick}
174+
disabled={!value.trim()}
175+
>
176+
생성하기
177+
</Button>
178+
</div>
179+
176180
</div>
177181
);
178182
}

src/pages/CreateRecipient/CreateRecipient.module.scss

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.create-page {
44
display: flex;
55
flex-direction: column;
6-
margin: 57px auto;
6+
margin: 57px auto 0;
77
max-width: 720px;
88
gap: 50px;
99

@@ -58,7 +58,7 @@
5858
.create-page__color--green {
5959
position: relative;
6060
width: 168px;
61-
height: 168px;
61+
aspect-ratio: 1 / 1;
6262
border: 1px solid rgba(0, 0, 0, 0.08);
6363
border-radius: 16px;
6464
list-style: none;
@@ -105,7 +105,7 @@
105105
.create-page__image--4 {
106106
position: relative;
107107
width: 168px;
108-
height: 168px;
108+
aspect-ratio: 1 / 1;
109109
border-radius: 16px;
110110
list-style: none;
111111
overflow: hidden;
@@ -136,3 +136,44 @@
136136
}
137137
}
138138
}
139+
140+
@media (max-width: 1024px) {
141+
.create-page {
142+
position: relative;
143+
min-height: calc(100vh - 57px - 65px);
144+
&__create-button {
145+
width: 100%;
146+
position: absolute;
147+
bottom: 24px;
148+
}
149+
}
150+
}
151+
152+
// 모바일 (768px 이하)
153+
@media (max-width: 768px) {
154+
.create-page {
155+
margin: 50px 20px 0;
156+
157+
&__input-section {
158+
width: 100%;
159+
}
160+
&__color-list,
161+
&__image-list {
162+
flex-wrap: wrap;
163+
justify-content: center;
164+
gap: 12px;
165+
padding-bottom: calc(82px + 56px);
166+
167+
.create-page__color--beige,
168+
.create-page__color--purple,
169+
.create-page__color--blue,
170+
.create-page__color--green,
171+
.create-page__image--1,
172+
.create-page__image--2,
173+
.create-page__image--3,
174+
.create-page__image--4 {
175+
width: calc((100% - 12px) / 2);
176+
}
177+
}
178+
}
179+
}

0 commit comments

Comments
 (0)