Skip to content

Commit

Permalink
fix: Home Intro buttons orientation
Browse files Browse the repository at this point in the history
  • Loading branch information
DiogoSoaress committed Oct 10, 2023
1 parent eecc579 commit ee310ad
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/Ecosystem/TextBlockItems/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const TextBlockItems = ({ title, text, buttons, items }: BaseBlock) => {
{title}
</Typography>
<Typography mb={5}>{text}</Typography>
<ButtonsWrapper buttons={buttons} />
<ButtonsWrapper buttons={buttons} mobileDirection="row" />
</Grid>
<Grid item md={2} display={{ xs: 'none', md: 'block' }} />
<Grid item md={5}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home/Intro/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Intro = ({ title, text, buttons }: BaseBlock) => {
</Grid>
<Grid item md={6}>
<Typography className={css.subtitle}>{text}</Typography>
<ButtonsWrapper buttons={buttons} />
<ButtonsWrapper buttons={buttons} mobileDirection="row" />
</Grid>
</Grid>
</Container>
Expand Down
9 changes: 7 additions & 2 deletions src/components/common/ButtonsWrapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ import { Button } from '@mui/material'
import Link from 'next/link'
import css from './styles.module.css'

const ButtonsWrapper = ({ buttons }: { buttons?: ButtonType[] }) => {
type ButtonsWrapperProps = {
buttons?: ButtonType[]
mobileDirection?: 'column' | 'row'
}

const ButtonsWrapper = ({ buttons, mobileDirection }: ButtonsWrapperProps) => {
if (!buttons || buttons.length === 0) return null

return (
<div className={css.wrapper}>
<div className={`${css.wrapper} ${mobileDirection === 'row' && css.mobileRow}`}>
{buttons.map((button, index) => {
const { text, variant, href, color = 'primary' } = button
const isButton = variant === 'button'
Expand Down
4 changes: 4 additions & 0 deletions src/components/common/ButtonsWrapper/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
gap: 24px;
}

.wrapper.mobileRow {
flex-direction: row;
}

@media (min-width: 900px) {
.wrapper {
flex-direction: row;
Expand Down

0 comments on commit ee310ad

Please sign in to comment.