mirror of
https://github.com/bspeice/speice.io
synced 2024-12-23 00:58:09 -05:00
21 lines
511 B
TypeScript
21 lines
511 B
TypeScript
import { PainterContext, SquareCanvas } from "../src/Canvas";
|
|
import { useContext, useEffect } from "react";
|
|
|
|
export function Render({ f }) {
|
|
const { width, height, setPainter } = useContext(PainterContext);
|
|
useEffect(() => {
|
|
if (width && height) {
|
|
const painter = f({ width, height });
|
|
setPainter(painter);
|
|
}
|
|
}, [width, height]);
|
|
return <></>;
|
|
}
|
|
|
|
export default function Gasket({ f }) {
|
|
return (
|
|
<SquareCanvas name={"gasket"}>
|
|
<Render f={f} />
|
|
</SquareCanvas>
|
|
);
|
|
} |