Skip to content

Commit

Permalink
refactor: component for Masthead footer
Browse files Browse the repository at this point in the history
  • Loading branch information
DiogoSoaress committed Dec 19, 2023
1 parent 4b44206 commit cff0b55
Showing 1 changed file with 29 additions and 22 deletions.
51 changes: 29 additions & 22 deletions src/components/common/Masthead/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,33 @@ import css from './styles.module.css'
import type { BaseBlock } from '@/components/Home/types'
import ButtonsWrapper from '@/components/common/ButtonsWrapper'

type FooterProps = {
text: string
logos: [
{
src: string
alt: string
},
]
}

const Footer = ({ logos, text }: FooterProps) => {
if (!logos) return null

return (
<div className={css.footer}>
{text ? (
<Typography variant="caption" mr="-14px">
{text}
</Typography>
) : null}
{logos.map((logo, index) => {
return <img src={logo.src} alt={logo.alt} key={index} />
})}
</div>
)
}

export const Masthead = ({
title,
buttons,
Expand All @@ -21,15 +48,7 @@ export const Masthead = ({
alt: string
}
backgroundImage: { sm: string; md: string }
footer: {
text: string
logos: [
{
src: string
alt: string
},
]
}
footer: FooterProps
}): ReactElement => {
const isSmallScreen = useMediaQuery('(max-width:900px)')

Expand Down Expand Up @@ -62,19 +81,7 @@ export const Masthead = ({
</Grid>
) : null}
</Grid>
{/* TODO: create a component? */}
{footer ? (
<div className={css.footer}>
{footer?.text ? (
<Typography variant="caption" mr="-14px">
{footer.text}
</Typography>
) : null}
{footer?.logos.map((logo, index) => {
return <img src={logo.src} alt={logo.alt} key={index} />
})}
</div>
) : null}
<Footer {...footer} />
</div>
</Container>
)
Expand Down

0 comments on commit cff0b55

Please sign in to comment.