From 1674fb2de103320a302bb5a8d446e14f77d6ddf0 Mon Sep 17 00:00:00 2001 From: mehbark Date: Tue, 28 Nov 2023 00:32:25 -0500 Subject: [PATCH] cycle: somewhat tractable --- html/common.tsx | 66 +++++++++++++++++++++++++++++++++++++++++++++ html/cycle-test.tsx | 16 +++++++++++ 2 files changed, 82 insertions(+) create mode 100644 html/cycle-test.tsx diff --git a/html/common.tsx b/html/common.tsx index e161b47..2d1717f 100644 --- a/html/common.tsx +++ b/html/common.tsx @@ -303,3 +303,69 @@ export function make_sync_no_matter_the_cost(promise: Promise): T { return out as T; } + +// INFINITE CREDIT TO @BLACKLE https://cohost.org/blackle/post/72096-h3-style-text-alig +export const Cycle = ({ + width_px, + height_px, + children, + style, +}: { + width_px: number; + height_px: number; + children: [ComponentChild, ...ComponentChild[]]; + style?: Record; +}) => ( +
+
+ {...children.map((c, i) => ( +
+ + {c} + +
+
+ ))} +
+
+); diff --git a/html/cycle-test.tsx b/html/cycle-test.tsx new file mode 100644 index 0000000..0b4852d --- /dev/null +++ b/html/cycle-test.tsx @@ -0,0 +1,16 @@ +import { Cycle, render_and_copy } from "./common.tsx"; + +render_and_copy( + +
this
+
won't
+
work
+
!
+
!!
+
!!!
+
+);