Skip to content

Commit d816139

Browse files
Navbar 로고와 Informationbar 반응형 수정 #53 from CodeitPart2/SCRUM-81-박찬영
Navbar 로고와 Informationbar 반응형 수정
2 parents 9942692 + 2138b8e commit d816139

5 files changed

Lines changed: 176 additions & 29 deletions

File tree

src/components/common/Emoji/Emoji.jsx

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ function Emoji({ topReactions = [], setRecipientData }) {
8686
<ArrowDown alt="더 보기" />
8787
</ShowMoreButton>
8888
)}
89-
<Button onClick={() => setShowPicker(!showPicker)} variant="outlined" image="add">추가</Button>
89+
90+
<StyledIcon>
91+
<StyledButton onClick={() => setShowPicker(!showPicker)} variant="outlined" image="add">
92+
<StyledText>추가</StyledText>
93+
</StyledButton>
94+
</StyledIcon>
9095
</ActionsContainer>
9196
</Header>
9297

@@ -114,6 +119,26 @@ function Emoji({ topReactions = [], setRecipientData }) {
114119

115120
export default Emoji;
116121

122+
const StyledIcon = styled.div`
123+
display: inline-block;
124+
`;
125+
126+
const StyledButton = styled(Button)`
127+
width: 88px;
128+
height: 36px;
129+
130+
@media (max-width: 768px) {
131+
width: 36px;
132+
height: 32px;
133+
}
134+
`;
135+
136+
const StyledText = styled.div`
137+
@media (max-width: 768px) {
138+
display: none;
139+
}
140+
`;
141+
117142
const ServiceContainer = styled.div`
118143
top: 6px;
119144
display: flex;
@@ -150,6 +175,7 @@ const TopEmojiItem = styled.div`
150175
gap: 2px;
151176
font-size: 20px;
152177
text-align: center;
178+
153179
`;
154180

155181
const EmojiImage = styled.span`
@@ -217,8 +243,8 @@ const AllEmojisContainer = styled.div`
217243
const MoreEmojisWrapper = styled.div`
218244
z-index: 10;
219245
position: absolute;
220-
top: -16px;
221-
right: -82px;
246+
top: 100%;
247+
right: -106px;
222248
width: 312px;
223249
background-color: ${(props) => props.theme.colors.white};
224250
border: 1px solid ${(props) => props.theme.colors.grayScale[300]};
@@ -228,8 +254,16 @@ const MoreEmojisWrapper = styled.div`
228254
display: grid;
229255
grid-template-columns: repeat(4, 1fr);
230256
grid-gap: 10px;
257+
margin-top: -14px;
258+
@media (max-width: 1199px) {
259+
right: -54px;
260+
}
261+
@media (max-width: 767px) {
262+
right: -156px;
263+
}
231264
`;
232265

266+
233267
const AllEmojiItem = styled.div`
234268
display: flex;
235269
align-items: center;

src/components/common/InformationBar/InformationBar.jsx

Lines changed: 94 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ function InformationBar({
1919
const [showToast, setShowToast] = useState(false);
2020
const buttonRef = useRef(null);
2121

22-
// ✅ 카카오 SDK 초기화 (한 번만 실행)
22+
2323
useEffect(() => {
2424
if (window.Kakao && !window.Kakao.isInitialized()) {
2525
window.Kakao.init("0e75199aafea8afc76aa6dd724c8f4bd"); // 🔥 여기에 JavaScript 키 입력
26-
console.log("Kakao SDK Initialized");
26+
console.log("Kakao SDK Initialized");
2727
}
2828
}, []);
2929

@@ -109,7 +109,7 @@ function InformationBar({
109109
</WritedContainer>
110110

111111
<SeparatorContainer>
112-
<Separator />
112+
<LeftSeparator />
113113
</SeparatorContainer>
114114

115115
<Emoji
@@ -120,13 +120,18 @@ function InformationBar({
120120
setRecipientData={setRecipientData}
121121
/>
122122
<Separator />
123-
<IconButton ref={buttonRef} onClick={toggleModal} image="share" width="56" />
123+
<ShareContainer>
124+
125+
<IconButton ref={buttonRef} onClick={toggleModal}
126+
image="share" width="56" height="40"/>
127+
124128
{isModalOpen && (
125129
<Modal ref={modalRef}>
126130
<Option onClick={shareToKakao}> 카카오톡 공유</Option>
127131
<Option onClick={handleCopyUrl}>URL 공유</Option>
128132
</Modal>
129133
)}
134+
</ShareContainer>
130135
</RightSection>
131136
</InformationBarContainer>
132137

@@ -148,12 +153,32 @@ function InformationBar({
148153
);
149154
}
150155

156+
const ShareContainer = styled.div`
157+
position: relative;
158+
display: inline-block; // 버튼 크기에 맞게 조정
159+
`;
160+
161+
const LeftSeparator = styled.span`
162+
display: inline-block;
163+
width: 1px;
164+
height: 30px;
165+
background-color: ${({ theme }) => theme.colors.grayScale[300]};
166+
margin: 0 13px;
167+
168+
@media (max-width: 1199px) {
169+
display: none;
170+
}
171+
`;
151172
const Separator = styled.span`
152173
display: inline-block;
153174
width: 1px;
154-
height: 28px;
175+
height: 30px;
155176
background-color: ${({ theme }) => theme.colors.grayScale[300]};
156177
margin: 0 13px;
178+
179+
@media (max-width: 768px) {
180+
margin: 0 0px;
181+
}
157182
`;
158183

159184
const SeparatorContainer = styled.div`
@@ -163,6 +188,9 @@ const SeparatorContainer = styled.div`
163188
`;
164189

165190
const InformationBarWrapper = styled.nav`
191+
position:fixed;
192+
z-index:998;
193+
top:58px;
166194
display: flex;
167195
justify-content: center;
168196
width: 100%;
@@ -184,21 +212,40 @@ const InformationBarContainer = styled.div`
184212
padding: 13px 24px;
185213
}
186214
@media (max-width: 767px) {
187-
215+
flex-direction: column;
216+
align-items: center;
217+
height: auto;
218+
padding: 10px;
188219
}
189220
`;
190221

191222
const LeftSection = styled.div`
192223
flex: 1;
193224
display: flex;
194225
justify-content: flex-start;
226+
227+
@media (max-width: 767px) {
228+
width: 100%;
229+
justify-content: center;
230+
margin-bottom: 10px;
231+
}
195232
`;
196233

197234
const RightSection = styled.div`
198235
display: flex;
199236
justify-content: flex-end;
200237
align-items: center;
201238
gap: 10px;
239+
margin-top: 10px;
240+
241+
@media (max-width: 1199px) {
242+
margin-top:0px;
243+
}
244+
@media (max-width: 767px) {
245+
margin-top:-8px;
246+
justify-content: center;
247+
gap: 10px;
248+
}
202249
`;
203250

204251
const ToName = styled.div`
@@ -208,12 +255,25 @@ const ToName = styled.div`
208255
line-height: 42px;
209256
letter-spacing: -0.01em;
210257
color: ${({ theme }) => theme.colors.grayScale[800]};
258+
margin-right: 10px;
211259
260+
@media (max-width: 767px) {
261+
left: 22px;
262+
font-size: 24px;
263+
margin-right: 0;
264+
margin-bottom: 10px;
265+
top:10px;
266+
position: absolute;
267+
}
212268
`;
213269

214270
const WritedContainer = styled.div`
215271
display: inline-flex;
216272
align-items: center;
273+
274+
@media (max-width: 767px) {
275+
display: none;
276+
}
217277
`;
218278

219279
const WriteCount = styled.span`
@@ -223,9 +283,13 @@ const WriteCount = styled.span`
223283
font-size: 18px;
224284
letter-spacing: 0%;
225285
line-height: 27px;
286+
226287
@media (max-width: 1199px) {
227288
display: none;
228289
}
290+
@media (max-width: 767px) {
291+
display: none;
292+
}
229293
`;
230294

231295
const WritedText = styled.span`
@@ -239,6 +303,9 @@ const WritedText = styled.span`
239303
@media (max-width: 1199px) {
240304
display: none;
241305
}
306+
@media (max-width: 767px) {
307+
display: none;
308+
}
242309
`;
243310

244311
const Avatar = styled.div`
@@ -272,12 +339,17 @@ const Avatar = styled.div`
272339
@media (max-width: 1199px) {
273340
display: none;
274341
}
342+
@media (max-width: 767px) {
343+
display: none;
344+
}
275345
`;
276346

277347
const Modal = styled.div`
278-
padding: 10px 1px;
279348
position: absolute;
280-
top: 122px;
349+
padding: 12px 0px;
350+
right:0px;
351+
margin-top:10px;
352+
top: 100%;
281353
background-color: ${({ theme }) => theme.colors.white};
282354
width: 140px;
283355
height: 120px;
@@ -296,10 +368,22 @@ const Modal = styled.div`
296368
transform: scale(1);
297369
}
298370
}
371+
@@media (max-width: 1199px) {
372+
right:7%;
373+
bottom: 100%;
374+
width: 140px;
375+
height: 120px;
376+
}
377+
@media (max-width: 767px) {
378+
right:7%;
379+
bottom: 100%;
380+
width: 140px;
381+
height: 120px;
382+
}
299383
`;
300384

301385
const Option = styled.div`
302-
padding: 10px;
386+
padding: 12px;
303387
cursor: pointer;
304388
font-family: "Pretendard", sans-serif;
305389
font-weight: 400;
@@ -332,6 +416,7 @@ const Toast = styled.div`
332416
height: 64px;
333417
}
334418
`;
419+
335420
const ToastMessage = styled.span`
336421
font-family: "Pretendard", sans-serif;
337422
font-weight: 400;
@@ -348,7 +433,6 @@ const IconTextWrapper = styled.div`
348433
align-items: center;
349434
`;
350435

351-
352436
const IconWrapper = styled.div`
353437
width: 24px;
354438
height: 24px;

src/components/common/Navbar/Navbar.jsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { Link, useLocation } from "react-router-dom";
22
import Button from "../Button/Button";
3-
43
import { LogoImg } from "../../../assets/images/icon/IconIndex";
54
import styled from "styled-components";
65

76
const NavbarWrapper = styled.nav`
7+
position:fixed;
8+
z-index:999;
89
display: flex;
910
justify-content: center;
1011
width: 100%;
@@ -20,26 +21,35 @@ const NavbarContainer = styled.nav`
2021
max-width: 1207px;
2122
height: 64px;
2223
padding: 11px 24px;
23-
24-
2524
`;
25+
2626
const StyledLogo = styled(LogoImg)`
27-
display: flex;
2827
width: 106px;
2928
cursor: pointer;
29+
30+
31+
@media (min-width: 1200px) {
32+
display: flex;
33+
}
34+
3035
31-
36+
@media (max-width: 767px) {
37+
display: ${({ showLogo }) => (showLogo ? 'flex' : 'none')};
38+
}
3239
`;
3340

3441
function Navbar() {
3542
const location = useLocation();
43+
44+
const showLogo = location.pathname === '/list' || location.pathname === '/';
45+
3646
const isPostPage = location.pathname.startsWith("/post");
3747

3848
return (
3949
<NavbarWrapper>
4050
<NavbarContainer>
4151
<Link to="/">
42-
<StyledLogo alt="Rolling Logo" />
52+
<StyledLogo alt="Rolling Logo" showLogo={showLogo} />
4353
</Link>
4454
{!isPostPage && (
4555
<Link to="/post">
@@ -53,4 +63,4 @@ function Navbar() {
5363
);
5464
}
5565

56-
export default Navbar;
66+
export default Navbar;

0 commit comments

Comments
 (0)