aboutsummaryrefslogtreecommitdiff
path: root/src/app/components/image
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2026-10-26 09:23:55 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2026-10-26 09:23:55 +0100
commit91d9b6992ac0ebee13704a3faefa8fd41a00075e (patch)
treeea0a30cc0cfb2232d3e60c845c20a67b6cdf0b99 /src/app/components/image
parent65300a13dcd11037218bf8ba61efd8ca19e5920e (diff)
zilch: dynamic element creation
Diffstat (limited to 'src/app/components/image')
-rw-r--r--src/app/components/image/index.css10
-rw-r--r--src/app/components/image/root.zig14
2 files changed, 15 insertions, 9 deletions
diff --git a/src/app/components/image/index.css b/src/app/components/image/index.css
index 86ba44e..034a509 100644
--- a/src/app/components/image/index.css
+++ b/src/app/components/image/index.css
@@ -1,12 +1,8 @@
-:host {
- --src: attr(src)
-}
-
.image {
- width: 100%;
- padding-bottom: 100%;
+ width: calc(100% / var(--gallery-splits));
+ padding-bottom: calc(100% / var(--gallery-splits));
height: 0;
- background-image: url("" ++ var(--src));
+ background: red;
background-size: cover;
background-position: center;
}
diff --git a/src/app/components/image/root.zig b/src/app/components/image/root.zig
index 971713d..c9aeef4 100644
--- a/src/app/components/image/root.zig
+++ b/src/app/components/image/root.zig
@@ -1,8 +1,18 @@
const zilch = @import("zilch");
-pub const component: zilch.Component = .{
+pub const component: zilch.Component = .build(.{
.name = "image",
.html = .parse(@embedFile("index.html")),
.css = @embedFile("index.css"),
.link = @This(),
-};
+});
+
+const Self = @This();
+
+element: *zilch.Object,
+
+pub fn init(self: *Self, element: *zilch.Object) !void {
+ self.element = element;
+}
+
+pub const connect = component.connect;