Skip to content

Commit d66b47a

Browse files
committed
Merge remote-tracking branch 'origin/sunwoong'
2 parents dcaa057 + 79513c5 commit d66b47a

File tree

4 files changed

+124
-24
lines changed

4 files changed

+124
-24
lines changed

src/components/header/Header.css

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
font-size: 20px;
2525
font-weight: 600;
2626
color: #333;
27+
text-decoration: none; /* ✅ 추가: 밑줄 제거 */
2728
}
2829

2930
/* 오른쪽: 로그인/회원가입 */
@@ -92,14 +93,26 @@
9293
background-color: #5a0099;
9394
}
9495

95-
/* 로그인 상태일 때 닉네임 표시 */
9696
.user-nickname {
97-
font-size: 17px;
97+
display: flex;
98+
align-items: center;
9899
font-weight: 600;
99-
color: #6a0dad;
100-
padding: 6px 12px;
100+
cursor: pointer;
101+
font-size: 1.05rem;
102+
}
103+
104+
.user-icon {
105+
margin-right: 8px;
106+
vertical-align: middle;
107+
color: #6a1b9a; /* 다크 퍼플 */
108+
}
109+
110+
/* 🌙 다크 모드에서도 잘 보이게 */
111+
.dark-mode .user-icon {
112+
color: #f0f0f0;
101113
}
102114

115+
103116
.theme-toggle-btn {
104117
background: none;
105118
border: none;
@@ -166,3 +179,49 @@
166179
.dark-mode .theme-toggle-btn {
167180
color: #b88eff;
168181
}
182+
183+
.user-dropdown {
184+
position: absolute;
185+
right: 30px;
186+
top: 100%;
187+
background-color: white;
188+
border: 1px solid #ddd;
189+
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
190+
border-radius: 6px;
191+
z-index: 1001;
192+
min-width: 100px;
193+
width: 120px; /* ✅ 자동 너비로 조정 */
194+
padding: 4px 0;
195+
}
196+
197+
.user-dropdown button {
198+
padding: 9px 1px;
199+
background: none;
200+
border: none;
201+
font-size: 14px;
202+
color: #333;
203+
cursor: pointer;
204+
text-align: center;
205+
width: 100%; /* ✅ 여기 유지해도 드롭다운 너비만 좁히면 괜찮음 */
206+
white-space: nowrap; /* ✅ 줄바꿈 방지 */
207+
font-weight: 600;
208+
}
209+
210+
211+
.user-dropdown button:hover {
212+
background-color: #f5f0ff;
213+
}
214+
215+
.dark-mode .user-dropdown {
216+
background-color: #2a2a2a;
217+
border-color: #444;
218+
}
219+
220+
.dark-mode .user-dropdown button {
221+
color: #ccc;
222+
font-weight: 600;
223+
}
224+
225+
.dark-mode .user-dropdown button:hover {
226+
background-color: #333;
227+
}

src/components/header/Header.jsx

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
1-
import React from "react";
2-
import { NavLink, Link } from "react-router-dom";
1+
import React, { useState } from "react";
2+
import { NavLink, Link, useNavigate } from "react-router-dom";
33
import { Link as ScrollLink } from "react-scroll";
4-
import { FaMoon, FaSun } from "react-icons/fa";
4+
import { FaMoon, FaSun, FaUserCircle } from "react-icons/fa"; // ✅ FaUserCircle 가져옴
55
import "./Header.css";
66

77
const Header = ({ isDark, setIsDark, isLoggedIn, nickname }) => {
8+
const [isMenuOpen, setIsMenuOpen] = useState(false);
9+
const navigate = useNavigate();
10+
811
const handleLogout = () => {
912
localStorage.clear();
10-
window.location.reload(); // 새로고침으로 상태 초기화
13+
navigate("/");
14+
window.location.reload();
15+
};
16+
17+
const toggleMenu = () => {
18+
setIsMenuOpen(!isMenuOpen);
19+
};
20+
21+
const goToMyPage = () => {
22+
navigate("/mypage");
23+
setIsMenuOpen(false);
1124
};
1225

1326
return (
1427
<header className="custom-header">
1528
<div className="header-left">
16-
<span className="site-name">Zivorp</span>
29+
<Link to="/" className="site-name">Zivorp</Link>
1730
</div>
1831

1932
<nav className="header-nav">
2033
<NavLink to="/" end></NavLink>
21-
<ScrollLink
22-
to="feature"
23-
smooth
24-
duration={500}
25-
offset={-64}
26-
spy={true}
27-
activeClass="active"
28-
></ScrollLink>
34+
<ScrollLink to="feature" smooth duration={500} offset={-64} spy={true} activeClass="active" />
2935
<NavLink to="/ide">IDE</NavLink>
3036
<NavLink to="/community">커뮤니티</NavLink>
3137
<NavLink to="/broadcast">코드 방송</NavLink>
@@ -41,10 +47,21 @@ const Header = ({ isDark, setIsDark, isLoggedIn, nickname }) => {
4147
</button>
4248

4349
{isLoggedIn ? (
44-
<>
45-
<span className="user-nickname">👤 {nickname}</span>
46-
<button onClick={handleLogout} className="btn btn-outline">로그아웃</button>
47-
</>
50+
<div className="user-menu-container">
51+
<span className="user-nickname" onClick={toggleMenu}>
52+
<FaUserCircle
53+
size={24}
54+
className={"user-icon"}
55+
/>
56+
{nickname} 님 ▾
57+
</span>
58+
{isMenuOpen && (
59+
<div className="user-dropdown">
60+
<button onClick={goToMyPage}>마이페이지</button>
61+
<button onClick={handleLogout}>로그아웃</button>
62+
</div>
63+
)}
64+
</div>
4865
) : (
4966
<>
5067
<Link to="/login" className="btn btn-outline">로그인</Link>

src/components/login/Login.css

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ body {
4040
.login-form {
4141
display: flex;
4242
flex-direction: column;
43-
gap: 1.2rem;
43+
gap: 0.8rem;
4444
}
4545

4646
.login-form label {
@@ -204,3 +204,22 @@ small {
204204
border: 1px solid #555;
205205
color: #aaa;
206206
}
207+
.forgot-password-link {
208+
text-align: right;
209+
margin-top: 0.2rem;
210+
}
211+
212+
.forgot-password-link a {
213+
color: #6a1b9a;
214+
font-size: 1rem;
215+
text-decoration: none;
216+
}
217+
218+
.forgot-password-link a:hover {
219+
text-decoration: underline;
220+
}
221+
222+
/* 🌙 다크 모드 링크 색상 */
223+
.dark-mode .forgot-password-link a {
224+
color: #b88eff;
225+
}

src/components/login/Login.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import axios from 'axios';
33
import config from '../../config';
44
import './Login.css';
55
import { useNavigate } from 'react-router-dom';
6+
import { Link } from 'react-router-dom';
7+
68

79
function Login() {
810
const [formData, setFormData] = useState({
@@ -66,7 +68,6 @@ function Login() {
6668

6769
<div className="password-container">
6870
<label htmlFor="password">비밀번호</label>
69-
<a href="/forgot-password">비밀번호 찾기</a>
7071
</div>
7172
<input
7273
id="password"
@@ -76,6 +77,9 @@ function Login() {
7677
onChange={handleChange}
7778
required
7879
/>
80+
<div className="forgot-password-link">
81+
<a href="#" onClick={(e) => e.preventDefault()}>비밀번호 찾기</a>
82+
</div>
7983

8084
<div className="remember-me">
8185
<input type="checkbox" id="remember" />
@@ -92,8 +96,9 @@ function Login() {
9296
</div>
9397

9498
<p className="signup-link">
95-
계정이 없으신가요? <a href="/signup">회원가입</a>
99+
계정이 없으신가요? <Link to="/signup">회원가입</Link>
96100
</p>
101+
97102
</div>
98103
</div>
99104
);

0 commit comments

Comments
 (0)