1
- import React from 'react'
2
- import { styled } from 'styled-components'
1
+ import React from 'react' ;
2
+ import { styled } from 'styled-components' ;
3
3
import { Link } from 'react-router-dom' ;
4
4
import { PropsState } from '@/app/App' ;
5
5
import { useAuth } from '@hooks/apis/useAuth' ;
@@ -8,9 +8,8 @@ import { me_info, Me_info_response } from '@apis/meApis';
8
8
import { Notifications } from '@assets/icons/indexIcons' ;
9
9
import theme from '@styles/theme' ;
10
10
11
-
12
- export const GlobalHeader : React . FC < PropsState > = ( props ) => {
13
- const { isLogin} = props ;
11
+ export const GlobalHeader : React . FC < PropsState > = props => {
12
+ const { isLogin } = props ;
14
13
15
14
const { url } = me_info ;
16
15
const { data } = useSwrData ( url ) ;
@@ -21,115 +20,106 @@ export const GlobalHeader: React.FC<PropsState> = (props) =>{
21
20
logout ( ) ;
22
21
} ;
23
22
24
- const {
25
- name = '' ,
26
- } = data ?? ( { } as Me_info_response ) ;
27
-
23
+ const { name = '' } = data ?? ( { } as Me_info_response ) ;
28
24
29
25
return (
30
26
< S . header >
31
27
< div className = "container" >
32
- < h1 className = ' logo' >
33
- < Link to = { "/" } >
28
+ < h1 className = " logo" >
29
+ < Link to = { '/' } >
34
30
< img src = "/imgs/logo.png" alt = "로고" />
35
- </ Link >
36
- </ h1 >
37
-
38
- < S . nav theme = { theme } >
39
- < ul >
40
- < li className = "user" >
41
- { isLogin ?
42
- < >
43
- < div className = "pic" >
44
- < img src = "/imgs/profile.png" alt = "프로필 사진" />
45
- </ div >
46
- < span className = 'userName' >
47
- { name } 님
48
- </ span >
49
- < button type = "button" onClick = { handleLogOutClick } style = { { cursor :"pointer" } } >
50
- 로그아웃
51
- </ button >
52
- < Notifications onClick = { ( ) => {
53
-
54
- } } style = { { cursor :"pointer" } } />
55
- </ >
56
- :
57
- < div > 비로그인 상태</ div > }
58
- </ li >
59
- </ ul >
60
- </ S . nav >
31
+ </ Link >
32
+ </ h1 >
33
+
34
+ < S . nav theme = { theme } >
35
+ < ul >
36
+ < li className = "user" >
37
+ { isLogin ? (
38
+ < >
39
+ < div className = "pic" >
40
+ < img src = "/imgs/profile.png" alt = "프로필 사진" />
41
+ </ div >
42
+ < span className = "userName" > { name } 님</ span >
43
+ < button type = "button" onClick = { handleLogOutClick } style = { { cursor : 'pointer' } } >
44
+ 로그아웃
45
+ </ button >
46
+ < Notifications onClick = { ( ) => { } } style = { { cursor : 'pointer' } } />
47
+ </ >
48
+ ) : (
49
+ < div > 비로그인 상태</ div >
50
+ ) }
51
+ </ li >
52
+ </ ul >
53
+ </ S . nav >
61
54
</ div >
62
55
</ S . header >
63
- )
64
- }
56
+ ) ;
57
+ } ;
65
58
66
59
const S = {
67
60
header : styled . header `
61
+ width: 100%;
62
+ height: 80px;
63
+ background-color: #fff;
64
+ border-bottom: 2px solid #e7e7e7;
65
+ position: sticky;
66
+ left: 0;
67
+ top: 0;
68
+ z-index: 999;
69
+
70
+ & > .container {
68
71
width: 100%;
69
- height: 80px;
70
- background-color: #fff;
71
- border-bottom: 2px solid #E7E7E7;
72
- position: fixed;
73
- left: 0;
74
- top: 0;
75
- z-index: 999;
76
-
77
- & > .container{
78
- width: 100%;
79
- max-width: 1280px;
80
- height: 100%;
81
- margin: 0 auto;
82
- display: flex;
83
- align-items: center;
84
- justify-content: space-between;
72
+ max-width: 1280px;
73
+ height: 100%;
74
+ margin: 0 auto;
75
+ display: flex;
76
+ align-items: center;
77
+ justify-content: space-between;
85
78
}
86
79
` ,
87
80
nav : styled . nav `
88
-
89
- .user{
81
+ .user {
90
82
height: 100%;
91
83
display: flex;
92
84
align-items: center;
93
85
94
- .pic{
86
+ .pic {
95
87
display: flex;
96
88
height: 100%;
97
89
align-items: center;
98
90
margin-right: 8px;
99
91
}
100
92
101
- .userName{
93
+ .userName {
102
94
margin-right: 14px;
103
95
}
104
96
105
- button{
97
+ button {
106
98
padding: 6px 20px;
107
- background-color: ${ ( { theme} ) => theme . colors [ " Gray-800" ] } ;
108
- color: ${ ( { theme} ) => theme . colors [ " Pri-400" ] } ;
99
+ background-color: ${ ( { theme } ) => theme . colors [ ' Gray-800' ] } ;
100
+ color: ${ ( { theme } ) => theme . colors [ ' Pri-400' ] } ;
109
101
border-radius: 6px;
110
102
margin-right: 40px;
111
103
position: relative;
112
- transition: all .4s;
104
+ transition: all 0 .4s;
113
105
114
- &:hover{
115
- background-color: ${ ( { theme} ) => theme . colors [ " Pri-400" ] } ;
116
- color: ${ ( { theme} ) => theme . colors [ " Gray-800" ] } ;
106
+ &:hover {
107
+ background-color: ${ ( { theme } ) => theme . colors [ ' Pri-400' ] } ;
108
+ color: ${ ( { theme } ) => theme . colors [ ' Gray-800' ] } ;
117
109
}
118
110
119
- &::after{
111
+ &::after {
120
112
display: block;
121
113
position: absolute;
122
114
right: -26px;
123
115
top: 50%;
124
116
transform: translateY(-50%);
125
- content: "|" ;
117
+ content: '|' ;
126
118
font-size: 2rem;
127
119
font-weight: 100;
128
- color: ${ ( { theme} ) => theme . colors [ " Gray-700" ] } ;
120
+ color: ${ ( { theme } ) => theme . colors [ ' Gray-700' ] } ;
129
121
}
130
122
}
131
-
132
123
}
133
-
134
- `
135
- }
124
+ ` ,
125
+ } ;
0 commit comments