From 0b2af471b6d5dfc4eaf53639102c1b854bbb324b Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Mon, 12 Oct 2026 09:43:19 +0200 Subject: first version of zilch --- src/app/components/icons/index.css | 4 ++++ src/app/components/icons/root.zig | 6 +++--- src/app/components/image/index.css | 0 src/app/components/image/index.html | 0 src/app/components/image/root.zig | 8 ++++++++ src/app/components/navbutton/index.css | 12 ++++++++++++ src/app/components/navbutton/root.zig | 18 +++++++++--------- src/app/components/root.zig | 5 +++-- 8 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 src/app/components/image/index.css create mode 100644 src/app/components/image/index.html create mode 100644 src/app/components/image/root.zig (limited to 'src/app/components') diff --git a/src/app/components/icons/index.css b/src/app/components/icons/index.css index e69de29..81badfd 100644 --- a/src/app/components/icons/index.css +++ b/src/app/components/icons/index.css @@ -0,0 +1,4 @@ +:host { + width: 16px; + height: 16px; +} diff --git a/src/app/components/icons/root.zig b/src/app/components/icons/root.zig index 6f7ab4a..be814d8 100644 --- a/src/app/components/icons/root.zig +++ b/src/app/components/icons/root.zig @@ -1,12 +1,12 @@ -const zs = @import("zeroscript"); +const zilch = @import("zilch"); -pub const icons: []const zs.Component = &.{ +pub const icons: []const zilch.Component = &.{ icon("menu"), icon("upload"), icon("settings"), }; -pub fn icon(name: []const u8) zs.Component { +pub fn icon(name: []const u8) zilch.Component { return .{ .namespace = "icon", .name = name, diff --git a/src/app/components/image/index.css b/src/app/components/image/index.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/image/index.html b/src/app/components/image/index.html new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/image/root.zig b/src/app/components/image/root.zig new file mode 100644 index 0000000..971713d --- /dev/null +++ b/src/app/components/image/root.zig @@ -0,0 +1,8 @@ +const zilch = @import("zilch"); + +pub const component: zilch.Component = .{ + .name = "image", + .html = .parse(@embedFile("index.html")), + .css = @embedFile("index.css"), + .link = @This(), +}; diff --git a/src/app/components/navbutton/index.css b/src/app/components/navbutton/index.css index 4c1a138..6909464 100644 --- a/src/app/components/navbutton/index.css +++ b/src/app/components/navbutton/index.css @@ -48,4 +48,16 @@ .item { margin: auto; + width: 40px; + height: 40px; + border-radius: 40px; + display: grid; +} + +.item * { + margin: auto; +} + +.item:hover { + background: #5f5e9c; } diff --git a/src/app/components/navbutton/root.zig b/src/app/components/navbutton/root.zig index b76af43..3505840 100644 --- a/src/app/components/navbutton/root.zig +++ b/src/app/components/navbutton/root.zig @@ -1,23 +1,23 @@ const std = @import("std"); -const zs = @import("zeroscript"); +const zilch = @import("zilch"); const Self = @This(); -pub const component: zs.Component = .{ +pub const component: zilch.Component = .{ .name = "navbutton", .html = .parse(@embedFile("index.html")), .css = @embedFile("index.css"), .link = @This(), }; -element: *zs.Object, -shadow_root: *zs.Object, +element: *zilch.Object, +shadow_root: *zilch.Object, button: struct { - classList: *zs.Object, + classList: *zilch.Object, }, -pub fn init(self: *Self, element: *zs.Object) !void { - var env: zs.Env = .default; +pub fn init(self: *Self, element: *zilch.Object) !void { + var env: zilch.Env = .default; defer env.deinit(); self.element = element; @@ -28,7 +28,7 @@ pub fn init(self: *Self, element: *zs.Object) !void { } pub fn deinit(self: *Self) !void { - var env: zs.Env = .default; + var env: zilch.Env = .default; defer env.deinit(); _ = self.element.free(&env); @@ -37,7 +37,7 @@ pub fn deinit(self: *Self) !void { } pub fn open(self: *Self) !void { - var env: zs.Env = .default; + var env: zilch.Env = .default; defer env.deinit(); _ = self.button.classList.call(&env, "toggle", .{"open"}); diff --git a/src/app/components/root.zig b/src/app/components/root.zig index 131ddb7..f51e3c1 100644 --- a/src/app/components/root.zig +++ b/src/app/components/root.zig @@ -1,7 +1,8 @@ -const zs = @import("zeroscript"); +const zilch = @import("zilch"); const icons = @import("icons/root.zig").icons; -pub const components = &[_]zs.Component{ +pub const components = &[_]zilch.Component{ @import("navbutton/root.zig").component, + @import("image/root.zig").component, } ++ icons; -- cgit v1.2.3-70-g09d2