11import { FC , ReactNode } from 'react'
22import { Trans , useTranslation } from 'react-i18next'
3- import Box from '@mui/material/Box'
4- import Typography from '@mui/material/Typography'
53import { useScreenSize } from '../../hooks/useScreensize'
6- import { styled } from '@mui/material/styles'
7- import Link from '@mui/material/Link'
8- import { useTheme } from '@mui/material/styles'
94import { useConstant } from '../../hooks/useConstant'
105import { AppendMobileSearch } from '../AppendMobileSearch'
116import { SearchScope } from '../../../types/searchScope'
127import { api , github } from '../../utils/externalLinks'
138import { ReopenAnalyticsConsentButton } from 'app/components/AnalyticsConsent'
14-
15- const FooterBox = styled ( Box , {
16- shouldForwardProp : prop => prop !== 'enableMobileSearch' ,
17- } ) < { enableMobileSearch : boolean } > ( ( { theme, enableMobileSearch } ) => ( {
18- display : 'flex' ,
19- width : '100%' ,
20- justifyContent : 'space-between' ,
21- padding : theme . spacing ( 5 , enableMobileSearch ? 4 : 0 ) ,
22- [ theme . breakpoints . up ( 'sm' ) ] : {
23- flex : '0 1 100%' ,
24- padding : theme . spacing ( 5 , 0 ) ,
25- } ,
26- } ) )
27-
28- const StyledBox = styled ( Box ) ( ( { theme } ) => ( {
29- display : 'flex' ,
30- alignItems : 'center' ,
31- } ) )
32-
33- const StyledLinksGroup = styled ( Box ) ( ( { theme } ) => ( {
34- display : 'flex' ,
35- gap : theme . spacing ( 3 ) ,
36- paddingLeft : theme . spacing ( 2 ) ,
37- } ) )
38-
39- const StyledTypography = styled ( Typography ) ( ( ) => ( {
40- display : 'flex' ,
41- alignItems : 'center' ,
42- gap : 2 ,
43- flexWrap : 'wrap' ,
44- } ) )
9+ import { Typography } from '@oasisprotocol/ui-library/src/components/typography'
10+ import { Link } from '@oasisprotocol/ui-library/src/components/link'
11+ import { cn } from '@oasisprotocol/ui-library/src/lib/utils'
4512
4613interface FooterProps {
4714 scope ?: SearchScope
@@ -50,36 +17,36 @@ interface FooterProps {
5017}
5118
5219export const Footer : FC < FooterProps > = ( { scope, mobileSearchAction, enableMobileSearch = true } ) => {
53- const theme = useTheme ( )
5420 const { t } = useTranslation ( )
5521 const { isMobile, isTablet } = useScreenSize ( )
5622 const currentYear = useConstant ( ( ) => new Date ( ) . getFullYear ( ) )
5723 const hasMobileAction = isMobile && mobileSearchAction
58- const privacyPolicyLinkStyles = hasMobileAction ? { order : 1 , flexBasis : '100%' } : { }
5924
6025 return (
6126 < footer >
62- < FooterBox enableMobileSearch = { enableMobileSearch } >
27+ < div
28+ className = { cn ( 'flex justify-between items-center py-6 sm:px-6' , enableMobileSearch ? 'px-2' : 'px-4' ) }
29+ >
6330 { isTablet ? (
6431 < AppendMobileSearch
6532 scope = { scope }
6633 action = { isMobile && mobileSearchAction }
6734 enableMobileSearch = { enableMobileSearch }
6835 >
69- < StyledTypography variant = "footer " >
70- < Box sx = { { whiteSpace : ' nowrap' } } > { t ( 'footer.mobileTitle' ) } |</ Box >
71- < Box sx = { privacyPolicyLinkStyles } >
36+ < Typography variant = "xsmall" textColor = "muted" className = "flex items-center gap-0.5 flex-wrap ">
37+ < div className = "whitespace- nowrap" > { t ( 'footer.mobileTitle' ) } |</ div >
38+ < div className = { cn ( hasMobileAction && 'order-1 basis-full sm:order-none sm:basis-auto' ) } >
7239 < ReopenAnalyticsConsentButton />
7340 { ! hasMobileAction && ' | ' }
74- </ Box >
75- < Box > { currentYear } </ Box >
76- </ StyledTypography >
41+ </ div >
42+ < div > { currentYear } </ div >
43+ </ Typography >
7744 </ AppendMobileSearch >
7845 ) : (
7946 < >
80- < StyledBox >
47+ < div className = "flex items-center" >
8148 { import . meta. env . REACT_APP_BUILD_SHA && (
82- < Typography variant = "footer " >
49+ < Typography variant = "xsmall" textColor = "muted ">
8350 < Trans
8451 t = { t }
8552 i18nKey = "footer.version"
@@ -89,7 +56,7 @@ export const Footer: FC<FooterProps> = ({ scope, mobileSearchAction, enableMobil
8956 href = { `${ github . releaseTag } ${ import . meta. env . REACT_APP_BUILD_VERSION } ` }
9057 rel = "noopener noreferrer"
9158 target = "_blank"
92- sx = { { color : theme . palette . layout . main } }
59+ textColor = "inherit"
9360 />
9461 ) : (
9562 < > -</ >
@@ -99,7 +66,7 @@ export const Footer: FC<FooterProps> = ({ scope, mobileSearchAction, enableMobil
9966 href = { `${ github . commit } ${ import . meta. env . REACT_APP_BUILD_SHA } ` }
10067 rel = "noopener noreferrer"
10168 target = "_blank"
102- sx = { { color : theme . palette . layout . main } }
69+ textColor = "inherit"
10370 />
10471 ) ,
10572 } }
@@ -125,36 +92,27 @@ export const Footer: FC<FooterProps> = ({ scope, mobileSearchAction, enableMobil
12592 />
12693 </ Typography >
12794 ) }
128- < StyledLinksGroup >
129- < Typography variant = "footer " >
95+ < div className = "flex gap-2 pl-1" >
96+ < Typography variant = "xsmall" textColor = "muted ">
13097 { ' | ' }
131- < Link
132- href = { api . spec }
133- rel = "noopener noreferrer"
134- target = "_blank"
135- sx = { { color : theme . palette . layout . main } }
136- >
98+ < Link href = { api . spec } rel = "noopener noreferrer" target = "_blank" textColor = "inherit" >
13799 { t ( 'footer.apiDocs' ) }
138100 </ Link >
139101 </ Typography >
140- < Typography variant = "footer" >
141- < Link
142- href = { github . home }
143- rel = "noopener noreferrer"
144- target = "_blank"
145- sx = { { color : theme . palette . layout . main } }
146- >
102+ < Typography variant = "xsmall" textColor = "muted" >
103+ { ' | ' }
104+ < Link href = { github . home } rel = "noopener noreferrer" target = "_blank" textColor = "inherit" >
147105 { t ( 'footer.github' ) }
148106 </ Link >
149107 </ Typography >
150- </ StyledLinksGroup >
151- </ StyledBox >
152- < Typography variant = "footer " >
108+ </ div >
109+ </ div >
110+ < Typography variant = "xsmall" textColor = "muted ">
153111 { t ( 'footer.title' ) } | < ReopenAnalyticsConsentButton /> | { currentYear }
154112 </ Typography >
155113 </ >
156114 ) }
157- </ FooterBox >
115+ </ div >
158116 </ footer >
159117 )
160118}
0 commit comments