Skip to content

Commit cd0f1fe

Browse files
authored
Merge pull request #1003 from julisod/pre-STAG-node-22
Styling updates + general fixes
2 parents 55575a5 + 2c20c7a commit cd0f1fe

31 files changed

Lines changed: 509 additions & 521 deletions

File tree

frontend/jsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"module": "commonjs",
44
"target": "es2016",
55
"jsx": "preserve",
6-
"checkJs": true,
76
"baseUrl": "./src"
87
},
98
"exclude": ["node_modules", "**/node_modules/*"]

frontend/package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/components/LanguageMenu/index.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22

3-
import Select from '@mui/material/Select'
4-
import MenuItem from '@mui/material/MenuItem'
3+
import { Select, MenuItem, InputBase } from '@mui/material/'
4+
import { styled } from '@mui/material/styles'
55

66
import { useTranslation } from 'react-i18next'
77

@@ -19,20 +19,21 @@ export default () => {
1919
} else {
2020
currentLanguage = i18n.language
2121
}
22+
23+
const SelectBox = styled(Select)({
24+
backgroundColor: 'white',
25+
borderWidth: '2px',
26+
borderColor: 'black',
27+
borderRadius: '0.5rem',
28+
paddingLeft: '0.5rem',
29+
})
30+
2231
return (
23-
<Select
24-
labelId="demo-simple-select-label"
25-
id="demo-simple-select"
32+
<SelectBox
2633
value={currentLanguage}
2734
onChange={handleChange}
2835
defaultValue={'en'}
29-
className="tw-text-black tw-border-1 tw-border-2 tw-border-solid tw-border-black tw-px-2 tw-py-0 tw-bg-white tw-rounded-lg"
30-
// style={{
31-
// padding: '8px 0px 8px 16px',
32-
// color: 'white',
33-
// backgroundColor: 'black',
34-
// }}
35-
disableUnderline
36+
input={<InputBase />} // Removes the default border
3637
>
3738
{/* <MenuItem value={'fi'}>
3839
<span role="img" aria-label="fi">
@@ -50,6 +51,6 @@ export default () => {
5051
ZH 🇨🇳
5152
</span>
5253
</MenuItem>
53-
</Select>
54+
</SelectBox>
5455
)
5556
}

frontend/src/components/UserAvatar/index.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,18 @@ export default () => {
2121

2222
return (
2323
<Box display="flex" flexDirection="row" alignItems="center">
24-
<div className="tw-rounded-full tw-border-8 tw-border-white">
25-
<IconButton onClick={handleClick}>
26-
<Avatar
27-
className="tw-w-12 tw-h-12"
28-
src={profile?.avatar}
29-
alt="Avatar"
30-
style={{
31-
border: `2px solid ${color['primary'].main}`,
32-
borderRadius: '50%',
33-
}}
34-
/>
35-
</IconButton>
36-
</div>
24+
<IconButton onClick={handleClick}>
25+
<Avatar
26+
src={profile?.avatar}
27+
alt="Avatar"
28+
style={{
29+
border: `2px solid ${color['primary'].main}`,
30+
borderRadius: '50%',
31+
height: '3rem',
32+
width: '3rem',
33+
}}
34+
/>
35+
</IconButton>
3736
</Box>
3837
)
3938
}
Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,48 @@
1-
import React, { useState } from 'react'
2-
import { useDispatch, useSelector } from 'react-redux'
3-
// import { push } from 'connected-react-router'
4-
import { Box, ListItem, ListItemText, Grid } from '@mui/material'
1+
import React from 'react'
2+
import { useSelector } from 'react-redux'
53
import * as AuthSelectors from 'reducers/auth/selectors'
6-
import JunctionTheme from 'junctionTheme.js'
4+
import { useNavigate } from 'react-router-dom'
5+
6+
import Box from '@mui/material/Box'
7+
import { styled } from '@mui/material/styles'
78
import Button from 'components/generic/Button'
89
import UserAvatar from 'components/UserAvatar'
9-
import { useMyProfilePreview } from 'graphql/queries/userProfile'
10-
import { styled } from '@mui/system'
11-
import { useLocation, useNavigate } from 'react-router-dom'
10+
import LanguageMenu from 'components/LanguageMenu'
1211

1312
import { useTranslation } from 'react-i18next'
14-
import LanguageMenu from 'components/LanguageMenu'
1513

1614
export default () => {
1715
const { t } = useTranslation()
1816
const navigate = useNavigate()
19-
const location = useLocation()
2017
const idTokenPayload = useSelector(AuthSelectors.getIdTokenPayload)
2118
const userId = idTokenPayload?.sub
22-
const dispatch = useDispatch()
23-
// const classes = useStyles()
2419

25-
if (!userId) {
26-
return (
27-
<Box display="flex" flexDirection="row" alignItems="center">
28-
<Grid container spacing={0}>
29-
<Grid item xs={12}>
30-
<Button
31-
onClick={() =>
32-
navigate('/login', {
33-
state: { nextRoute: location.pathname },
34-
})
35-
}
36-
strong={true}
37-
>
38-
{t('Sign_in_')}
39-
</Button>
40-
</Grid>
41-
</Grid>
42-
</Box>
43-
)
44-
}
20+
const UserMenu = styled(Box)(({ theme }) => ({
21+
display: 'flex',
22+
alignItems: 'center',
23+
flexDirection: 'column',
24+
[theme.breakpoints.up('sm')]: {
25+
flexDirection: 'row',
26+
},
27+
gap: '0.5em',
28+
}))
4529

4630
return (
47-
<Box className="tw-gap-2 tw-flex tw-flex-col md:tw-flex-row tw-items-center">
31+
<UserMenu>
4832
<LanguageMenu />
4933
{userId ? (
5034
<>
5135
<Button
5236
onClick={() => navigate('/dashboard/default/')}
5337
strong={true}
5438
variant="contained"
55-
// className={classes.menuBox}
5639
>
5740
{t('Dashboard_')}
5841
</Button>
5942
<Button
6043
onClick={() => navigate('/logout')}
6144
strong={true}
6245
variant="outlined"
63-
className={'tw-bg-white tw-text-black'}
64-
// className={classes.menuBox}
6546
>
6647
{t('Log_out_')}
6748
</Button>
@@ -76,6 +57,6 @@ export default () => {
7657
{t('Sign_in_')}
7758
</Button>
7859
)}
79-
</Box>
60+
</UserMenu>
8061
)
8162
}

0 commit comments

Comments
 (0)