hlm looking pretty sweet

This commit is contained in:
mehbark 2023-07-15 22:53:32 -04:00
parent ca9fd28ebc
commit d3c337fae2
2 changed files with 13 additions and 3 deletions

View file

@ -50,3 +50,8 @@ export const render_and_copy = (elem: VNode) => {
writeText(rendered); writeText(rendered);
console.log(rendered); console.log(rendered);
}; };
export const mk_class_wrapper =
(klass: string) =>
({ children }: { children: ComponentChildren }) =>
<div class="klass">{...toChildArray(children)}</div>;

View file

@ -1,7 +1,7 @@
import { EggbugImg, Main, render_and_copy } from "./common.tsx"; import { EggbugImg, Main, render_and_copy } from "./common.tsx";
import { ComponentChildren, JSX, toChildArray } from "preact"; import { ComponentChildren, JSX, toChildArray } from "preact";
const Pulse = ({ children }: { children: ComponentChildren }): JSX.Element => ( const Pulse = ({ children }: { children: ComponentChildren }) => (
<div class="pulse"> <div class="pulse">
<div class="pulse-bottom">{...toChildArray(children)}</div> <div class="pulse-bottom">{...toChildArray(children)}</div>
<div class="pulse-top">{...toChildArray(children)}</div> <div class="pulse-top">{...toChildArray(children)}</div>
@ -12,9 +12,14 @@ const Portrait = ({ href, alt }: { href: string; alt: string }) => (
<img class="portrait" href={href} alt={alt} /> <img class="portrait" href={href} alt={alt} />
); );
const Wiggle = ({ children }: { children: ComponentChildren }) => (
<div class="wiggle">{...toChildArray(children)}</div>
);
const PortraitFrame = ({ children }: { children: ComponentChildren }) => ( const PortraitFrame = ({ children }: { children: ComponentChildren }) => (
<div class="portrait-frame"> <div class="portrait-frame">
<div class="portrait-frame-inner">{children}</div> <div class="portrait-frame-inner"></div>
<Wiggle>{children}</Wiggle>
</div> </div>
); );
@ -29,7 +34,7 @@ const PortraitFrame = ({ children }: { children: ComponentChildren }) => (
// i'll probably go for a different ui element // i'll probably go for a different ui element
render_and_copy( render_and_copy(
<Main> <Main>
<div class="top">press [rmb] to AWESOMESAUCE</div> <div class="top">press [rmb] to open browser context menu</div>
<div class="middle"> <div class="middle">
<div class="game"></div> <div class="game"></div>
<PortraitFrame> <PortraitFrame>