Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WebFront
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
websystem
WebFront
Commits
3f31ecaf
Commit
3f31ecaf
authored
6 months ago
by
석찬 윤
Browse files
Options
Downloads
Patches
Plain Diff
feat: 로그인 상태에 따른 헤딩바 변형 (
#10
)
parent
628a44e1
Branches
feat/#10
No related tags found
1 merge request
!8
[#10] 로그인 페이지 개발
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/layout/HeaderLogoBar.jsx
+13
-1
13 additions, 1 deletion
src/components/layout/HeaderLogoBar.jsx
src/components/layout/HeaderNav.jsx
+25
-17
25 additions, 17 deletions
src/components/layout/HeaderNav.jsx
src/store/authStore.js
+1
-0
1 addition, 0 deletions
src/store/authStore.js
with
39 additions
and
18 deletions
src/components/layout/HeaderLogoBar.jsx
+
13
−
1
View file @
3f31ecaf
import
React
from
"
react
"
;
import
LogoIcon
from
"
../icons/LogoIcon
"
;
import
LogoIcon
from
"
../icons/LogoIcon
"
;
import
useAuthStore
from
"
../../store/authStore
"
;
const
HeaderLogoBar
=
()
=>
{
const
HeaderLogoBar
=
()
=>
{
const
{
user
}
=
useAuthStore
();
// Zustand에서 user 상태 가져오기
return
(
return
(
<
div
className
=
"flex items-center justify-start w-full h-16 px-4 bg-white"
>
<
div
className
=
"flex items-center justify-between w-full h-16 px-4 bg-white"
>
{
/* 왼쪽: 로고와 앱 이름 */
}
<
div
className
=
"flex items-center"
>
<
div
className
=
"flex items-center"
>
<
LogoIcon
width
=
{
32
}
height
=
{
32
}
/>
<
LogoIcon
width
=
{
32
}
height
=
{
32
}
/>
<
span
className
=
"title-1"
>
YANAWA
</
span
>
<
span
className
=
"title-1"
>
YANAWA
</
span
>
</
div
>
</
div
>
{
/* 오른쪽: 사용자 이름 */
}
<
div
className
=
"flex items-center"
>
<
span
className
=
"text-gray-600 label-1"
>
{
user
?
`
${
user
.
name
}
`
:
"
guest
"
}
님
</
span
>
</
div
>
</
div
>
</
div
>
);
);
};
};
...
...
This diff is collapsed.
Click to expand it.
src/components/layout/HeaderNav.jsx
+
25
−
17
View file @
3f31ecaf
...
@@ -2,10 +2,12 @@ import React, { useState, useEffect } from "react";
...
@@ -2,10 +2,12 @@ import React, { useState, useEffect } from "react";
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
Button
from
"
../Button
"
;
import
Button
from
"
../Button
"
;
import
LogoIcon
from
"
../icons/LogoIcon
"
;
import
LogoIcon
from
"
../icons/LogoIcon
"
;
import
useAuthStore
from
"
../../store/authStore
"
;
export
default
function
HeaderNav
()
{
export
default
function
HeaderNav
()
{
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
const
[
isMobile
,
setIsMobile
]
=
useState
(
false
);
const
[
isMobile
,
setIsMobile
]
=
useState
(
false
);
const
{
user
}
=
useAuthStore
();
// Zustand에서 user 상태 가져오기
useEffect
(()
=>
{
useEffect
(()
=>
{
const
checkMobile
=
()
=>
setIsMobile
(
window
.
innerWidth
<=
768
);
const
checkMobile
=
()
=>
setIsMobile
(
window
.
innerWidth
<=
768
);
...
@@ -18,6 +20,7 @@ export default function HeaderNav() {
...
@@ -18,6 +20,7 @@ export default function HeaderNav() {
const
navigateToHome
=
()
=>
navigate
(
"
/
"
);
const
navigateToHome
=
()
=>
navigate
(
"
/
"
);
const
navigateToChattingList
=
()
=>
navigate
(
"
/chattinglist
"
);
const
navigateToChattingList
=
()
=>
navigate
(
"
/chattinglist
"
);
const
navigateToLogin
=
()
=>
navigate
(
"
/login
"
);
const
navigateToLogin
=
()
=>
navigate
(
"
/login
"
);
const
navigateToMyPage
=
()
=>
navigate
(
"
/mypage
"
);
return
(
return
(
<
header
className
=
"bg-white shadow-md"
>
<
header
className
=
"bg-white shadow-md"
>
...
@@ -47,20 +50,14 @@ export default function HeaderNav() {
...
@@ -47,20 +50,14 @@ export default function HeaderNav() {
size
=
"icon"
size
=
"icon"
theme
=
"black"
theme
=
"black"
icon
=
{
<
LogoIcon
fillColor
=
"#ffffff"
/>
}
icon
=
{
<
LogoIcon
fillColor
=
"#ffffff"
/>
}
onClick
=
{
navigateToLogin
}
onClick
=
{
user
?
navigateToMyPage
:
navigateToLogin
}
// 조건부 이동
/>
/>
</>
</>
)
:
(
)
:
(
<>
<>
<
Button
size
=
"icon"
theme
=
"pink"
icon
=
{
<
LogoIcon
fillColor
=
"#ffffff"
/>
}
onClick
=
{
navigateToHome
}
/>
<
Button
<
Button
size
=
"lg"
size
=
"lg"
theme
=
"p
urple
"
theme
=
"p
ink
"
icon
=
{
<
LogoIcon
fillColor
=
"#ffffff"
/>
}
icon
=
{
<
LogoIcon
fillColor
=
"#ffffff"
/>
}
onClick
=
{
navigateToHome
}
onClick
=
{
navigateToHome
}
>
>
...
@@ -68,7 +65,7 @@ export default function HeaderNav() {
...
@@ -68,7 +65,7 @@ export default function HeaderNav() {
</
Button
>
</
Button
>
<
Button
<
Button
size
=
"lg"
size
=
"lg"
theme
=
"
indigo
"
theme
=
"
purple
"
icon
=
{
<
LogoIcon
fillColor
=
"#ffffff"
/>
}
icon
=
{
<
LogoIcon
fillColor
=
"#ffffff"
/>
}
onClick
=
{
navigateToTimeTable
}
onClick
=
{
navigateToTimeTable
}
>
>
...
@@ -82,6 +79,16 @@ export default function HeaderNav() {
...
@@ -82,6 +79,16 @@ export default function HeaderNav() {
>
>
번개채팅방
번개채팅방
</
Button
>
</
Button
>
{
user
?
(
<
Button
size
=
"lg"
theme
=
"black"
icon
=
{
<
LogoIcon
fillColor
=
"#ffffff"
/>
}
onClick
=
{
navigateToMyPage
}
>
마이페이지
</
Button
>
)
:
(
<
Button
<
Button
size
=
"lg"
size
=
"lg"
theme
=
"black"
theme
=
"black"
...
@@ -90,6 +97,7 @@ export default function HeaderNav() {
...
@@ -90,6 +97,7 @@ export default function HeaderNav() {
>
>
로그인
로그인
</
Button
>
</
Button
>
)
}
</>
</>
)
}
)
}
</
div
>
</
div
>
...
...
This diff is collapsed.
Click to expand it.
src/store/authStore.js
+
1
−
0
View file @
3f31ecaf
...
@@ -3,6 +3,7 @@ import { getSessionInfo, logout } from "../api/auth";
...
@@ -3,6 +3,7 @@ import { getSessionInfo, logout } from "../api/auth";
const
useAuthStore
=
create
((
set
)
=>
({
const
useAuthStore
=
create
((
set
)
=>
({
user
:
null
,
// 사용자 정보
user
:
null
,
// 사용자 정보
// user: { name: "윤석찬", email: "ysc0731@ajou.ac.kr" }, // 사용자 정보
// 세션 정보 가져오기
// 세션 정보 가져오기
fetchSession
:
async
()
=>
{
fetchSession
:
async
()
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment