import { JSX } from "preact"; import { Main, render_and_copy } from "./common.tsx"; const peopleify = (...people: string[]): string[] => // non-breaking space v people.map(p => `${p}\u202fpeople`); const animation_length = (num_items: number): number => /*num_items / 5*/ 3; const wheel_style = ( num_items: number, width?: number, shl?: number, n?: number ): JSX.CSSProperties => ({ transform: `translateY(calc(2rem * -${num_items}))`, animation: `${animation_length( num_items )}s ease-in-out reverse none running spin`, width: width ? `width: ${width * 100}%` : undefined, marginLeft: shl && n ? `-${shl * (n + 1)}px` : undefined, }); const get_delays = (...lengths: number[]): number[] => { const out = [0]; for (const l of lengths) { out.push((out.at(-1) ?? 0) + animation_length(l)); } return out; }; const Wheel = ({ items, width, calc_width, shl, n, classes, }: { items: string[]; width?: number; calc_width?: number; shl?: number; n?: number; classes: string[]; }) => (
{/* {...items.map((i: string) =>
{i}
)} */}
{/*
*/} {...items.map((item, i) => (
{item}
))}
); function slices(arr: T[]): T[][] { return arr.map((_, i) => arr.slice(0, i)); } function weird_slices(arr: T[]): T[][] { console.log(arr.map(item => [...arr.filter(t => t != item), item])); return arr.map(item => [...arr.filter(t => t != item), item]); } const MultiWheel = ({ items, calc_width, shl, type, }: { items: string[]; calc_width?: number; shl?: number; type: string; }) => ( {...weird_slices(items).map((sliced_items, n) => ( ))} ); // i'll probably just hardcode the delays... lame but w/e // nope // it would be possible to have it so the final text is actually properyly selectable maybe but eh const Take = ({ subjects, objects, adjectives, }: { subjects: string[]; objects: string[]; adjectives: string[]; }) => (
{" "}
who eat
{" "} {" "}
are
{" "}
); const Checkmark = () => ( the old, white twitter verified checkmark ); const Author = () => (
a picture of a blonde, white woman wearing a black coat and looking at her phone. presumably phoebe bridgers
traitor joe
@​phoebe_bridgers
); const Info = () => (
10:02 PM ·{" "} Feb 20, 2021 ·{" "} Twitter for iPhone
); const Stats = () => (
3,228 Retweets 803 Quote Tweets
); // might want to have the final item be seperate // turned out to be unnecessary render_and_copy(


);