@@ -4,6 +4,7 @@ import { animated, useSpring } from "react-spring";
4
4
import { useDispatch , useSelector } from "react-redux" ;
5
5
import FormControlLabel from "@material-ui/core/FormControlLabel" ;
6
6
import Grid from "@material-ui/core/Grid" ;
7
+ import Hidden from "@material-ui/core/Hidden" ;
7
8
import IconButton from "@material-ui/core/IconButton" ;
8
9
import IosSwitch from "./ios-switch" ;
9
10
import { LinkV2 } from "src/components/link-v2" ;
@@ -27,17 +28,27 @@ const useStyles = makeStyles((theme: Theme) =>
27
28
zIndex : 100 ,
28
29
width : "100%" ,
29
30
} ,
31
+ TopBar : {
32
+ background : theme . palette . background . default ,
33
+ borderBottom : `1px solid ${ theme . palette . background . paper } ` ,
34
+ margin : 0 ,
35
+ padding : " 5px 0" ,
30
36
37
+ display : "flex" ,
38
+ justifyContent : "flex-end" ,
39
+ [ theme . breakpoints . down ( "sm" ) ] : {
40
+ padding : " 0 20px" ,
41
+ } ,
42
+ } ,
43
+ switch : {
44
+ marginLeft : "auto" ,
45
+ } ,
31
46
icon : {
32
47
color : theme . palette . grey [ 100 ] ,
33
48
} ,
34
49
button : {
35
50
color : theme . palette . grey [ 100 ] ,
36
51
} ,
37
- toolbar : {
38
- borderBottom : `1px solid ${ theme . palette . background . paper } ` ,
39
- background : theme . palette . background . default ,
40
- } ,
41
52
toolbarContainer : {
42
53
maxWidth : theme . breakpoints . values . lg ,
43
54
margin : "auto" ,
@@ -48,17 +59,27 @@ const useStyles = makeStyles((theme: Theme) =>
48
59
borderBottom : `1px solid ${ theme . palette . background . paper } ` ,
49
60
} ,
50
61
toolbarTitle : {
51
- flex : 1 ,
62
+ marginRight : "auto" ,
52
63
} ,
53
64
toolbarLink : {
65
+ display : "flex" ,
66
+ alignItems : "center" ,
67
+ justifyContent : "center" ,
54
68
color : theme . palette . text . primary ,
55
- padding : theme . spacing ( 1 ) ,
69
+ fontSize : "16px" ,
70
+ fontWeight : "revert" ,
71
+ padding : theme . spacing ( 4 ) ,
72
+ paddingTop : 0 ,
73
+ paddingBottom : 0 ,
56
74
flexShrink : 0 ,
57
75
textDecoration : "none" ,
58
76
"&:hover" : {
59
77
textDecoration : "none" ,
60
78
color : theme . palette . primary . main ,
61
79
} ,
80
+ [ theme . breakpoints . down ( "sm" ) ] : {
81
+ padding : "5px" ,
82
+ } ,
62
83
} ,
63
84
logo : {
64
85
display : "flex" ,
@@ -124,17 +145,8 @@ export const Navbar: React.FC = () => {
124
145
125
146
return (
126
147
< animated . header className = { classes . root } style = { props } >
127
- < Toolbar className = { classes . toolbar } >
128
- < Grid
129
- container
130
- item
131
- xs = { 12 }
132
- lg = { 10 }
133
- className = { classes . toolbarContainer }
134
- >
135
- < IconButton >
136
- < SearchIcon className = { classes . search } />
137
- </ IconButton >
148
+ < div className = { `${ classes . toolbarContainer } ${ classes . TopBar } ` } >
149
+ < Hidden mdUp >
138
150
< Typography
139
151
component = "h2"
140
152
variant = "h5"
@@ -147,19 +159,19 @@ export const Navbar: React.FC = () => {
147
159
< img src = { logo } alt = "logo" className = { classes . logoImg } />
148
160
</ LinkV2 >
149
161
</ Typography >
150
- < FormControlLabel
151
- control = {
152
- < IosSwitch
153
- checked = { darkMode ? true : false }
154
- onChange = { toggleDarkMode }
155
- name = " darkMode"
156
- />
157
- }
158
- label = { darkMode ? "🌙" : "🌞" }
159
- />
160
- </ Grid >
161
- </ Toolbar >
162
-
162
+ </ Hidden >
163
+ < FormControlLabel
164
+ className = { classes . switch }
165
+ control = {
166
+ < IosSwitch
167
+ checked = { darkMode ? true : false }
168
+ onChange = { toggleDarkMode }
169
+ name = "darkMode"
170
+ />
171
+ }
172
+ label = { darkMode ? "🌙" : "🌞" }
173
+ / >
174
+ </ div >
163
175
< Toolbar
164
176
component = "nav"
165
177
variant = "dense"
@@ -173,6 +185,21 @@ export const Navbar: React.FC = () => {
173
185
className = { classes . toolbarContainer }
174
186
style = { { flexFlow : "nowrap" , overflowX : "auto" } }
175
187
>
188
+ < Hidden smDown >
189
+ < Typography
190
+ component = "h2"
191
+ variant = "h5"
192
+ color = "inherit"
193
+ align = "center"
194
+ noWrap
195
+ className = { classes . toolbarTitle }
196
+ >
197
+ < LinkV2 href = "/" className = { classes . logo } >
198
+ < img src = { logo } alt = "logo" className = { classes . logoImg } />
199
+ </ LinkV2 >
200
+ </ Typography >
201
+ </ Hidden >
202
+
176
203
{ sections
177
204
? sections . map ( ( section ) => (
178
205
< LinkV2
@@ -185,6 +212,10 @@ export const Navbar: React.FC = () => {
185
212
</ LinkV2 >
186
213
) )
187
214
: null }
215
+
216
+ < IconButton >
217
+ < SearchIcon className = { classes . search } />
218
+ </ IconButton >
188
219
</ Grid >
189
220
</ Toolbar >
190
221
</ animated . header >
0 commit comments