From f327b5386301d4269ab0ba2f9ce5ee3de714f612 Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Fri, 29 Nov 2024 23:19:19 -0500 Subject: [PATCH] Fix initial posts to use the new painter API --- .../1-introduction/Gasket.tsx | 16 ++++++++++++++++ .../1-introduction/chaosGame.js | 8 +------- .../1-introduction/index.mdx | 2 -- .../1-introduction/scope.tsx | 7 ++----- 4 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 blog/2024-11-15-playing-with-fire/1-introduction/Gasket.tsx diff --git a/blog/2024-11-15-playing-with-fire/1-introduction/Gasket.tsx b/blog/2024-11-15-playing-with-fire/1-introduction/Gasket.tsx new file mode 100644 index 0000000..1b96395 --- /dev/null +++ b/blog/2024-11-15-playing-with-fire/1-introduction/Gasket.tsx @@ -0,0 +1,16 @@ +import Canvas, {PainterContext} from "../src/Canvas"; +import {useContext} from "react"; + +export function Render({f}) { + const {setPainter} = useContext(PainterContext); + setPainter(f); + return <>; +} + +export default function Gasket({f}) { + return ( + + + + ) +} \ No newline at end of file diff --git a/blog/2024-11-15-playing-with-fire/1-introduction/chaosGame.js b/blog/2024-11-15-playing-with-fire/1-introduction/chaosGame.js index a3e6ce0..2644edf 100644 --- a/blog/2024-11-15-playing-with-fire/1-introduction/chaosGame.js +++ b/blog/2024-11-15-playing-with-fire/1-introduction/chaosGame.js @@ -27,10 +27,4 @@ function* chaosGame() { } // Wiring so the code above displays properly -function Gasket() { - const {setPainter} = useContext(PainterContext); - setPainter(chaosGame()); - - return (<>) -} -render() +render() diff --git a/blog/2024-11-15-playing-with-fire/1-introduction/index.mdx b/blog/2024-11-15-playing-with-fire/1-introduction/index.mdx index c4f1890..eb904cf 100644 --- a/blog/2024-11-15-playing-with-fire/1-introduction/index.mdx +++ b/blog/2024-11-15-playing-with-fire/1-introduction/index.mdx @@ -177,9 +177,7 @@ import Scope from './scope' import chaosGameSource from '!!raw-loader!./chaosGame' -
diff --git a/blog/2024-11-15-playing-with-fire/1-introduction/scope.tsx b/blog/2024-11-15-playing-with-fire/1-introduction/scope.tsx index 4ffe6d4..dc05043 100644 --- a/blog/2024-11-15-playing-with-fire/1-introduction/scope.tsx +++ b/blog/2024-11-15-playing-with-fire/1-introduction/scope.tsx @@ -1,15 +1,12 @@ -import {useContext} from "react"; +import Gasket from "./Gasket"; import { plot } from './plot'; import { randomBiUnit } from '../src/randomBiUnit'; import { randomInteger } from '../src/randomInteger'; -import Canvas, {PainterContext} from "../src/Canvas"; const Scope = { - Canvas, - PainterContext, + Gasket, plot, randomBiUnit, randomInteger, - useContext, } export default Scope; \ No newline at end of file