Skip to content

Commit 608605a

Browse files
Merge pull request #187 from dzcode-io/163-navbar-General-UI-UX-changes
163 Header UI/UX changes
2 parents a8d33d3 + 68e1bdf commit 608605a

File tree

20 files changed

+206
-106
lines changed

20 files changed

+206
-106
lines changed

data/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ dist
55
!*.ts
66
!*.js
77
!*.json
8+
*.svg

data/.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
node_modules/
22
dist
3-
*.eslintignore
3+
*.prettierignore
44
*.tsbuildinfo
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
node_modules/
22
dist
33
.*
4-
*.eslintignore
4+
*.prettierignore
55
*.tsbuildinfo
66
*.tsx
77
*.ts
88
*.js
99
*.json
10+
*.svg

data/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"scripts": {
66
"eslint:check": "eslint \"**/*.*\" --report-unused-disable-directives",
77
"eslint:fix": "eslint \"**/*.*\" --quiet --fix",
8-
"prettier:check": "prettier \"**/*.*\" --check --ignore-path ./eslint.eslintignore",
9-
"prettier:fix": "prettier \"**/*.*\" --write --ignore-path ./eslint.eslintignore",
8+
"prettier:check": "prettier \"**/*.*\" --check --ignore-path ./eslint.prettierignore",
9+
"prettier:fix": "prettier \"**/*.*\" --write --ignore-path ./eslint.prettierignore",
1010
"build": "tsc",
1111
"generate": "node dist/build.js",
1212
"build:watch": "tsc --watch",

frontend/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ firebase
55
!*.ts
66
!*.js
77
!*.json
8+
*.svg

frontend/.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
firebase
22
node_modules/
33
dist
4-
*.eslintignore
4+
*.prettierignore
55
*.tsbuildinfo

frontend/eslint.eslintignore renamed to frontend/eslint.prettierignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ dist
55
# images
66
*.jpeg
77
*.png
8+
*.svg
89
*.ico
910

1011

11-
*.eslintignore
12+
*.prettierignore
1213
*.tsbuildinfo
1314
*.tsx
1415
*.ts
1516
*.js
1617
*.json
18+

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"dev": "yarn clear && cross-env NODE_ENV=development webpack-dev-server --config ./webpack.config.js -wd --hot",
88
"eslint:check": "eslint \"**/*.*\" --report-unused-disable-directives",
99
"eslint:fix": "eslint \"**/*.*\" --quiet --fix",
10-
"prettier:check": "prettier \"**/*.*\" --check --ignore-path ./eslint.eslintignore",
11-
"prettier:fix": "prettier \"**/*.*\" --write --ignore-path ./eslint.eslintignore",
10+
"prettier:check": "prettier \"**/*.*\" --check --ignore-path ./eslint.prettierignore",
11+
"prettier:fix": "prettier \"**/*.*\" --write --ignore-path ./eslint.prettierignore",
1212
"test": "echo 0",
1313
"build": "yarn clear cross-env && NODE_ENV=production webpack --config ./webpack.config.js --display-error-details",
1414
"generate:sitemap": "node src/build/sitemap.js"
Lines changed: 1 addition & 0 deletions
Loading

frontend/src/apps/main/components/navbar/index.tsx

Lines changed: 61 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { animated, useSpring } from "react-spring";
44
import { useDispatch, useSelector } from "react-redux";
55
import FormControlLabel from "@material-ui/core/FormControlLabel";
66
import Grid from "@material-ui/core/Grid";
7+
import Hidden from "@material-ui/core/Hidden";
78
import IconButton from "@material-ui/core/IconButton";
89
import IosSwitch from "./ios-switch";
910
import { LinkV2 } from "src/components/link-v2";
@@ -27,17 +28,27 @@ const useStyles = makeStyles((theme: Theme) =>
2728
zIndex: 100,
2829
width: "100%",
2930
},
31+
TopBar: {
32+
background: theme.palette.background.default,
33+
borderBottom: `1px solid ${theme.palette.background.paper}`,
34+
margin: 0,
35+
padding: " 5px 0",
3036

37+
display: "flex",
38+
justifyContent: "flex-end",
39+
[theme.breakpoints.down("sm")]: {
40+
padding: " 0 20px",
41+
},
42+
},
43+
switch: {
44+
marginLeft: "auto",
45+
},
3146
icon: {
3247
color: theme.palette.grey[100],
3348
},
3449
button: {
3550
color: theme.palette.grey[100],
3651
},
37-
toolbar: {
38-
borderBottom: `1px solid ${theme.palette.background.paper}`,
39-
background: theme.palette.background.default,
40-
},
4152
toolbarContainer: {
4253
maxWidth: theme.breakpoints.values.lg,
4354
margin: "auto",
@@ -48,17 +59,27 @@ const useStyles = makeStyles((theme: Theme) =>
4859
borderBottom: `1px solid ${theme.palette.background.paper}`,
4960
},
5061
toolbarTitle: {
51-
flex: 1,
62+
marginRight: "auto",
5263
},
5364
toolbarLink: {
65+
display: "flex",
66+
alignItems: "center",
67+
justifyContent: "center",
5468
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,
5674
flexShrink: 0,
5775
textDecoration: "none",
5876
"&:hover": {
5977
textDecoration: "none",
6078
color: theme.palette.primary.main,
6179
},
80+
[theme.breakpoints.down("sm")]: {
81+
padding: "5px",
82+
},
6283
},
6384
logo: {
6485
display: "flex",
@@ -124,17 +145,8 @@ export const Navbar: React.FC = () => {
124145

125146
return (
126147
<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>
138150
<Typography
139151
component="h2"
140152
variant="h5"
@@ -147,19 +159,19 @@ export const Navbar: React.FC = () => {
147159
<img src={logo} alt="logo" className={classes.logoImg} />
148160
</LinkV2>
149161
</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>
163175
<Toolbar
164176
component="nav"
165177
variant="dense"
@@ -173,6 +185,21 @@ export const Navbar: React.FC = () => {
173185
className={classes.toolbarContainer}
174186
style={{ flexFlow: "nowrap", overflowX: "auto" }}
175187
>
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+
176203
{sections
177204
? sections.map((section) => (
178205
<LinkV2
@@ -185,6 +212,10 @@ export const Navbar: React.FC = () => {
185212
</LinkV2>
186213
))
187214
: null}
215+
216+
<IconButton>
217+
<SearchIcon className={classes.search} />
218+
</IconButton>
188219
</Grid>
189220
</Toolbar>
190221
</animated.header>

0 commit comments

Comments
 (0)