2024-12-08 19:53:06 -05:00
|
|
|
import {SquareCanvas, PainterContext} from "../src/Canvas";
|
|
|
|
import {useContext, useEffect} from "react";
|
2024-11-29 23:19:19 -05:00
|
|
|
|
|
|
|
export function Render({f}) {
|
2024-12-08 19:53:06 -05:00
|
|
|
const {width, height, setPainter} = useContext(PainterContext);
|
|
|
|
useEffect(() => {
|
|
|
|
if (width && height) {
|
|
|
|
const painter = f({width, height});
|
|
|
|
setPainter(painter);
|
|
|
|
}
|
|
|
|
}, [width, height]);
|
2024-11-29 23:19:19 -05:00
|
|
|
return <></>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function Gasket({f}) {
|
|
|
|
return (
|
2024-12-08 19:53:06 -05:00
|
|
|
<SquareCanvas>
|
2024-11-29 23:19:19 -05:00
|
|
|
<Render f={f}/>
|
2024-12-08 19:53:06 -05:00
|
|
|
</SquareCanvas>
|
2024-11-29 23:19:19 -05:00
|
|
|
)
|
|
|
|
}
|