cohost/html/stars.tsx

25 lines
619 B
TypeScript
Raw Normal View History

2023-11-22 23:27:19 -05:00
import { render_and_copy } from "./common.tsx";
const Star = () => (
<div
class="star same-place"
style={{
transform: `translate(calc(${(Math.random() * 50 - 25).toFixed(
2
)}rem * var(--tw-border-opacity, 0)), calc(${(
Math.random() * 50 -
25
).toFixed(2)}rem * var(--tw-border-opacity, 0)))`,
}}
>
*
</div>
);
const Stars = ({ n }: { n: number }) => (
<div id="stars" class="same-place">
{...Array.from({ length: n }, Star)}
</div>
);
render_and_copy(<Stars n={150} />);