mirror of
https://github.com/ziex-dev/ziex.git
synced 2026-07-20 18:49:33 -06:00
35 lines
899 B
Zig
35 lines
899 B
Zig
pub fn Page(allocator: zx.Allocator) zx.Component {
|
|
var _zx = @import("zx").x.allocInit(allocator);
|
|
return _zx.ele(
|
|
.main,
|
|
.{
|
|
.allocator = allocator,
|
|
.children = &.{
|
|
_zx.cmp(
|
|
components.Button,
|
|
.{ .name = "Button" },
|
|
.{ .title = "Custom Button" },
|
|
),
|
|
},
|
|
},
|
|
);
|
|
}
|
|
|
|
const components = struct {
|
|
const ButtonProps = struct { title: []const u8 };
|
|
pub fn Button(allocator: zx.Allocator, props: ButtonProps) zx.Component {
|
|
var _zx = @import("zx").x.allocInit(allocator);
|
|
return _zx.ele(
|
|
.button,
|
|
.{
|
|
.allocator = allocator,
|
|
.children = &.{
|
|
_zx.expr(props.title),
|
|
},
|
|
},
|
|
);
|
|
}
|
|
};
|
|
|
|
const zx = @import("zx");
|