import React, { CSSProperties, useEffect, useState } from "react"; import { Image } from "./Image"; import styles from "./ShapesBackground.module.css"; interface Props { getConfig?: GetShapesConfig; } export function ShapesBackground({ getConfig }: Props) { const [config, setConfig] = useState({}); useEffect(() => { setConfig(getConfig?.() ?? {}); }, [getConfig]); return (
{Object.entries(config).map(([type, instances]) => instances.map((attributes, idx) => ( )) )}
); } export type ShapeType = | "asterisk" | "circle" | "cross" | "dots" | "hash" | "plus" | "ring" | "triangle" | "waves"; export type ShapesConfig = { [key in ShapeType]?: CSSProperties[]; }; export type GetShapesConfig = () => ShapesConfig; function Shape(props: { type: ShapeType; style: CSSProperties }) { return ( ); }