add colored horizontal rule block
This commit is contained in:
24
web/src/components/blocks/HorizontalRuleBlock.tsx
Normal file
24
web/src/components/blocks/HorizontalRuleBlock.tsx
Normal file
@ -0,0 +1,24 @@
|
||||
import { HorizontalRuleBlock as HorizontalRuleBlockType } from "@/gql/graphql";
|
||||
import Image from "../general/Image";
|
||||
import styles from "./imageWithTextBlock.module.scss";
|
||||
|
||||
export const HorizontalRuleBlock = ({
|
||||
block,
|
||||
}: {
|
||||
block: HorizontalRuleBlockType;
|
||||
}) => {
|
||||
const knownColors = [
|
||||
"deepBrick",
|
||||
"neufPink",
|
||||
"goldenOrange",
|
||||
"goldenBeige",
|
||||
"chateauBlue",
|
||||
];
|
||||
const defaultColor = "chateauBlue";
|
||||
const color =
|
||||
typeof block?.color === "string" && knownColors.includes(block.color)
|
||||
? block.color
|
||||
: defaultColor;
|
||||
|
||||
return <hr attr-color={color} />;
|
||||
};
|
Reference in New Issue
Block a user