ziex/test/data/component/csr_zig.zig
Nurul Huda (Apon) 33ec71739d
refactor(ast): use direct import of zx
- This is to allow importing zx with any other decl name than zx
2026-02-09 11:14:05 +06:00

43 lines
1.1 KiB
Zig

pub fn Page(allocator: zx.Allocator) zx.Component {
var _zx = @import("zx").allocInit(allocator);
return _zx.ele(
.main,
.{
.allocator = allocator,
.children = &.{
_zx.cmp(
CounterComponent,
.{ .client = .{ .name = "CounterComponent", .id = "c8fee6a" } },
.{},
),
_zx.cmp(
CounterComponent,
.{},
.{},
),
_zx.cmp(
Button,
.{ .client = .{ .name = "Button", .id = "cd02624" } },
.{ .title = "Custom Button" },
),
},
},
);
}
pub fn CounterComponent(allocator: zx.Allocator) zx.Component {
var _zx = @import("zx").allocInit(allocator);
return _zx.ele(
.button,
.{
.allocator = allocator,
.children = &.{
_zx.txt("Counter"),
},
},
);
}
const Button = @import("basic.zig").Button;
const zx = @import("zx");