|
1 | 1 | import { FC, PropsWithChildren, ReactNode } from 'react' |
2 | 2 | import { Header } from './Header' |
3 | 3 | import { Footer } from './Footer' |
4 | | -import Box from '@mui/material/Box' |
5 | 4 | import { useScreenSize } from '../../hooks/useScreensize' |
6 | | -import { styled, useTheme } from '@mui/material/styles' |
7 | 5 | import { BuildBanner } from '../BuildBanner' |
8 | 6 | import { useScopeParam } from '../../hooks/useScopeParam' |
9 | 7 | import { NetworkOfflineBanner, RuntimeOfflineBanner, ConsensusOfflineBanner } from '../OfflineBanner' |
10 | 8 | import { Search } from '../Search' |
11 | 9 | import { useIsApiReachable } from '../OfflineBanner/hook' |
| 10 | +import useTheme from '@mui/material/styles/useTheme' |
12 | 11 |
|
13 | 12 | interface PageLayoutProps { |
14 | 13 | mobileFooterAction?: ReactNode |
15 | 14 | } |
16 | 15 |
|
17 | | -export const StyledMain = styled('main')({ |
18 | | - minHeight: '75vh', |
19 | | -}) |
20 | | - |
21 | 16 | export const PageLayout: FC<PropsWithChildren<PageLayoutProps>> = ({ children, mobileFooterAction }) => { |
22 | | - const theme = useTheme() |
23 | 17 | const { isMobile } = useScreenSize() |
24 | 18 | const scope = useScopeParam() |
25 | 19 | const isApiReachable = useIsApiReachable(scope?.network ?? 'mainnet').reachable |
| 20 | + const theme = useTheme() |
26 | 21 |
|
27 | 22 | return ( |
28 | 23 | <> |
29 | 24 | <BuildBanner /> |
30 | 25 | <NetworkOfflineBanner /> |
31 | 26 | {scope && scope.layer !== 'consensus' && <RuntimeOfflineBanner />} |
32 | 27 | {scope && scope.layer === 'consensus' && <ConsensusOfflineBanner />} |
33 | | - <Box |
34 | | - sx={{ |
35 | | - minHeight: '100vh', |
36 | | - }} |
37 | | - > |
| 28 | + <div className="min-h-screen"> |
38 | 29 | <Header /> |
39 | | - <Box |
40 | | - sx={ |
41 | | - isMobile |
42 | | - ? { |
43 | | - border: |
44 | | - theme.palette.background.default !== theme.palette.layout.border |
45 | | - ? `solid 10px ${theme.palette.layout.border}` |
46 | | - : 'none', |
47 | | - borderTop: 0, |
48 | | - px: 0, |
49 | | - pt: 4, |
50 | | - } |
51 | | - : { |
52 | | - border: `solid 15px ${theme.palette.layout.border}`, |
53 | | - borderTop: 0, |
54 | | - px: '4%', |
55 | | - pt: 6, |
56 | | - } |
57 | | - } |
| 30 | + <div |
| 31 | + className="border-8 md:border-[15px] border-transparent px-0 md:px-[4%] pt-4 md:pt-6 border-t-0" |
| 32 | + style={{ |
| 33 | + borderColor: theme.palette.layout.border, |
| 34 | + }} |
58 | 35 | > |
59 | 36 | {!isMobile && ( |
60 | | - <Box |
61 | | - sx={{ |
62 | | - mb: 6, |
63 | | - }} |
64 | | - > |
| 37 | + <div className="mb-6"> |
65 | 38 | <Search scope={scope} disabled={!isApiReachable} /> |
66 | | - </Box> |
| 39 | + </div> |
67 | 40 | )} |
68 | | - <StyledMain>{children}</StyledMain> |
| 41 | + <main className="min-h-[75vh]">{children}</main> |
69 | 42 | <Footer scope={scope} mobileSearchAction={mobileFooterAction} /> |
70 | | - </Box> |
71 | | - </Box> |
| 43 | + </div> |
| 44 | + </div> |
72 | 45 | </> |
73 | 46 | ) |
74 | 47 | } |
0 commit comments