simplify fact box types
This commit is contained in:
@ -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>
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user