Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 13x 24x 24x 24x | import { useTranslation } from 'next-i18next'
import { AlertPage } from '../lib/types'
import { useAlerts } from '../lib/useAlerts'
import AlertSection from './AlertSection'
import { MarkdownContent } from './MarkdownContent'
export interface AlertBlockProps {
page?: AlertPage
className?: string
}
const AlertBlock = ({ page, className }: AlertBlockProps) => {
const { data } = useAlerts({ page })
const { i18n } = useTranslation()
return (
<div className={className}>
{data?.map(({ textEn, textFr, type, uid }) => {
const markdown = i18n.language === 'fr' ? textFr : textEn
return (
<AlertSection key={uid} type={type} className="mb-4 mt-4">
<MarkdownContent markdown={markdown} />
</AlertSection>
)
})}
</div>
)
}
export default AlertBlock
|