simplify fact box types

This commit is contained in:
2024-07-15 20:56:16 +02:00
parent ea5ea5cf1c
commit a73a0799fc
11 changed files with 203 additions and 172 deletions

View File

@ -3,18 +3,23 @@ import { FactBoxBlock as FactBoxBlockType } from "@/gql/graphql";
import styles from "./factBoxBlock.module.scss";
import { Blocks } from "./Blocks";
export const FactBoxBlock = ({ block }: { block: FactBoxBlockType }) => {
type FactBoxBlockTypeWithAlias = FactBoxBlockType & {
factBoxBody?: string
}
export const FactBoxBlock = ({ block }: { block: FactBoxBlockTypeWithAlias }) => {
if (!block.factBoxBody) {
return <></>;
}
return (
<section
className={styles.factBox}
data-background-color={block.backgroundColor ?? ""}
>
<div className={styles.factBoxHeader}>
<span>{block.heading}</span>
</div>
<div className={styles.factBoxContent}>
<Blocks blocks={block.body} />
</div>
<div
className={styles.factBoxContent}
dangerouslySetInnerHTML={{ __html: block.factBoxBody }}
/>
</section>
);
};