Skip to content

Commit

Permalink
fix: restore CenteredTextBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
DiogoSoaress committed Oct 9, 2024
1 parent 4b48a7e commit f6a463b
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/components/Token/CenteredTextBlock/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Container, Typography } from '@mui/material'
import { type BaseBlockEntry } from '@/config/types'
import RichText from '@/components/common/RichText'
import layoutCss from '@/components/common/styles.module.css'
import css from './styles.module.css'
import ButtonsWrapper from '@/components/Token/ButtonsWrapper'
import { isEntryTypeButton } from '@/lib/typeGuards'

const CenteredTextBlock = (props: BaseBlockEntry) => {
const { caption, title, text, buttons } = props.fields

const buttonsList = buttons?.filter(isEntryTypeButton) || []

return (
<Container className={`${layoutCss.containerShort} ${layoutCss.centeredContent}`}>
<Typography variant="caption">{caption}</Typography>

<div>
<div className={css.title}>
<RichText {...title} />
</div>

{text && (
<div className={css.text}>
<RichText {...text} />
</div>
)}
</div>

{buttonsList.length > 0 && (
<div className={css.buttons}>
<ButtonsWrapper buttons={buttonsList} />
</div>
)}
</Container>
)
}

export default CenteredTextBlock
22 changes: 22 additions & 0 deletions src/components/Token/CenteredTextBlock/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.title {
margin-top: 16px;
}

.text {
margin: 24px auto 0;
max-width: 725px;
}

.text p {
margin: 0;
}

.buttons {
margin-top: 40px;
}

@media (min-width: 900px) {
.title {
text-align: center;
}
}

0 comments on commit f6a463b

Please sign in to comment.