Skip to content

Commit 2450fa7

Browse files
authored
Merge pull request #2199 from oasisprotocol/kaja/uil-header-grid
Kaja/uil header grid
2 parents ab8988d + 9ce7086 commit 2450fa7

File tree

4 files changed

+18
-40
lines changed

4 files changed

+18
-40
lines changed

.changelog/2199.trivial.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Convert header Grid and Box MUI elements to tailwind

src/app/components/PageLayout/Header.tsx

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { FC } from 'react'
22
import AppBar from '@mui/material/AppBar'
3-
import Grid from '@mui/material/Unstable_Grid2'
43
import useScrollTrigger from '@mui/material/useScrollTrigger'
54
import { useTheme } from '@mui/material/styles'
65
import { HomePageLink } from './Logotype'
76
import { NetworkSelector } from './NetworkSelector'
8-
import Box from '@mui/material/Box'
97
import Button from '@mui/material/Button'
108
import { useScopeParam } from '../../hooks/useScopeParam'
119
import { useScreenSize } from '../../hooks/useScreensize'
@@ -38,27 +36,20 @@ export const Header: FC = () => {
3836
boxShadow: '0px 4px 6px -1px rgba(0, 0, 0, 0.10), 0px 2px 4px -1px rgba(0, 0, 0, 0.06)',
3937
}}
4038
>
41-
<Box sx={{ px: '15px' }}>
42-
<Grid
43-
container
44-
sx={{
45-
px: isMobile ? 0 : '4%',
46-
pt: isMobile ? 4 : '15px',
47-
pb: 4,
48-
}}
49-
>
50-
<Grid lg={3} xs={4} sx={{ display: 'flex', alignItems: 'center' }}>
39+
<div className="px-4">
40+
<div className="grid grid-cols-12 pt-3 pb-4 px-0 md:px-[4%]">
41+
<div className="col-span-6 xl:col-span-3 flex items-center">
5142
<HomePageLink showText={!scrollTrigger && !isMobile} color="#0500e2" />
52-
</Grid>
43+
</div>
44+
5345
{withScopeSelector && (
54-
<>
55-
<Grid lg={6} xs={8}>
56-
<NetworkSelector layer={scope.layer} network={scope.network} />
57-
</Grid>
58-
</>
46+
<div className="col-span-6 xl:col-span-6 flex justify-end xl:justify-center items-center">
47+
<NetworkSelector layer={scope.layer} network={scope.network} />
48+
</div>
5949
)}
50+
6051
{isDesktop && (
61-
<Grid lg={3} xs={4} sx={{ display: 'flex', justifyContent: 'flex-end' }}>
52+
<div className="col-span-3 flex justify-end items-center">
6253
<Button
6354
component="a"
6455
href="https://rose.oasis.io/"
@@ -70,10 +61,10 @@ export const Header: FC = () => {
7061
>
7162
{t('common.visitRoseApp')}
7263
</Button>
73-
</Grid>
64+
</div>
7465
)}
75-
</Grid>
76-
</Box>
66+
</div>
67+
</div>
7768
</AppBar>
7869
)
7970
}
Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import { FC } from 'react'
22
import { useTranslation } from 'react-i18next'
33
import { useScreenSize } from '../../hooks/useScreensize'
4-
import Link from '@mui/material/Link'
5-
import { useTheme } from '@mui/material/styles'
6-
import Box from '@mui/material/Box'
74
import { Link as RouterLink } from 'react-router-dom'
85
import { OasisIcon } from '../CustomIcons/OasisIcon'
96
import { ExplorerIcon } from '../CustomIcons/ExplorerIcon'
@@ -17,30 +14,20 @@ export const HomePageLink: FC<LogotypeProps> = ({ color, showText }) => {
1714
const { t } = useTranslation()
1815

1916
return (
20-
<Link
21-
aria-label={t('home.link')}
22-
to="/"
23-
component={RouterLink}
24-
sx={{ display: 'inline-flex', textDecoration: 'none' }}
25-
>
17+
<RouterLink to="/" aria-label={t('home.link')}>
2618
<Logotype color={color} showText={showText} />
27-
</Link>
19+
</RouterLink>
2820
)
2921
}
3022

3123
export const Logotype: FC<LogotypeProps> = ({ color, showText }) => {
32-
const theme = useTheme()
3324
const { isMobile } = useScreenSize()
3425
const oasisLogoSize = isMobile ? 32 : 40
3526
const logoSize = !showText ? { height: oasisLogoSize, width: oasisLogoSize } : { height: 40, width: 214 }
3627

3728
return (
38-
<Box
39-
sx={{
40-
color: color || theme.palette.layout.main,
41-
}}
42-
>
29+
<div className="flex items-center text-primary">
4330
{!showText ? <OasisIcon sx={logoSize} /> : <ExplorerIcon sx={logoSize} />}
44-
</Box>
31+
</div>
4532
)
4633
}

src/app/components/PageLayout/NetworkButton.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ export const NetworkButton: FC<NetworkButtonProps> = ({ isOutOfDate, layer, netw
8888

8989
return (
9090
<StyledNetworkButton
91-
sx={{ ml: 4 }}
9291
size="small"
9392
variant="outlined"
9493
startIcon={icons[network]}

0 commit comments

Comments
 (0)