From c3126ffaa809e07168d136d3754cd8e2bc21da61 Mon Sep 17 00:00:00 2001 From: mehbark Date: Sun, 26 Nov 2023 22:10:42 -0500 Subject: [PATCH] train: let's do a version without the track transform --- deno.lock | 2 ++ html/train.tsx | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 html/train.tsx diff --git a/deno.lock b/deno.lock index de77918..93c455a 100644 --- a/deno.lock +++ b/deno.lock @@ -123,6 +123,8 @@ "https://esm.sh/preact@10.16.0/jsx-runtime?dts": "9e67b64a5b48299c77d30bffc213735fdcf4b3b5d4ad8ff8d4136f246de5fa34", "https://esm.sh/stable/preact@10.16.0/denonext/jsx-runtime.js": "64770c709df77c4b64b79f84a4abf6189fd0c3ea461121870eca0cf2bcca87b0", "https://esm.sh/stable/preact@10.16.0/denonext/preact.mjs": "01dc8bdf124926c611c0711081b9c162cf2735cccad7c2bc9914766f633ddb1d", + "https://esm.sh/stable/preact@10.16.0/denonext/src.js": "a95281269ac2665427e647cde8628d5cd6eef13bb6bea381c3167a78fa922316", + "https://esm.sh/v128/preact@10.16.0/src/index.js": "3bafc9400950c38b80163dcbcd4538a54ef158a83f448517f34324c5685f1569", "https://esm.sh/v134/preact-render-to-string@5.2.0/X-ZS9wcmVhY3Q/denonext/preact-render-to-string.mjs": "b2b771d82125460bd3e5cdf20ebd662a08c4c61e34b174cd11db929dd5883966" } } diff --git a/html/train.tsx b/html/train.tsx new file mode 100644 index 0000000..5211dea --- /dev/null +++ b/html/train.tsx @@ -0,0 +1,52 @@ +import { render_and_copy } from "./common.tsx"; +import { ComponentChildren } from "preact"; + +const Rail = ({ rotation, r }: { rotation: string; r: string }) => ( +
+ 🪜 +
+); + +const Track = ({ + segments, + r, + children, +}: { + segments: number; + r: string; + children?: ComponentChildren; +}) => ( +
+ {...Array.from({ length: segments }, (_, i) => ( + // deg is actually more efficient lel + + ))} + {children} +
+); + +render_and_copy( + +
+
+
🚂
+
+
+ +);