mirror of
https://github.com/ziex-dev/ziex.git
synced 2026-07-22 11:39:34 -06:00
33 lines
786 B
Zig
33 lines
786 B
Zig
pub fn Page(allocator: zx.Allocator) zx.Component {
|
|
return (
|
|
<main @allocator={allocator}>
|
|
<Wrapper>
|
|
<p>Wrapped content</p>
|
|
</Wrapper>
|
|
<Card>
|
|
<span>Card content</span>
|
|
</Card>
|
|
</main>
|
|
);
|
|
}
|
|
|
|
/// Component using ComponentContext (void props, children only)
|
|
pub fn Wrapper(ctx: *zx.ComponentContext) zx.Component {
|
|
return (
|
|
<div @allocator={ctx.allocator} class="wrapper">
|
|
{ctx.children}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
/// Another component using ComponentContext
|
|
fn Card(ctx: *zx.ComponentContext) zx.Component {
|
|
return (
|
|
<article @allocator={ctx.allocator} class="card">
|
|
{ctx.children}
|
|
</article>
|
|
);
|
|
}
|
|
|
|
const zx = @import("zx");
|