aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2026-10-19 18:03:59 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2026-10-19 18:03:59 +0200
commit65300a13dcd11037218bf8ba61efd8ca19e5920e (patch)
tree7c65fcc708ec43be8386c31fec191ea8c0c9a1bf /src
parentb34ebbe68ce399bc754f2688845f380a7b47bd60 (diff)
add favicon
Diffstat (limited to 'src')
-rw-r--r--src/app/components/image/index.css12
-rw-r--r--src/app/components/image/index.html2
-rw-r--r--src/app/index.html1
-rw-r--r--src/app/root.zig1
-rw-r--r--src/app/theme.css5
-rw-r--r--src/favicon.pngbin0 -> 27614 bytes
-rw-r--r--src/main.zig1
-rw-r--r--src/zilch/App/root.zig7
8 files changed, 28 insertions, 1 deletions
diff --git a/src/app/components/image/index.css b/src/app/components/image/index.css
index e69de29..86ba44e 100644
--- a/src/app/components/image/index.css
+++ b/src/app/components/image/index.css
@@ -0,0 +1,12 @@
+:host {
+ --src: attr(src)
+}
+
+.image {
+ width: 100%;
+ padding-bottom: 100%;
+ height: 0;
+ background-image: url("" ++ var(--src));
+ background-size: cover;
+ background-position: center;
+}
diff --git a/src/app/components/image/index.html b/src/app/components/image/index.html
index e69de29..bd124ad 100644
--- a/src/app/components/image/index.html
+++ b/src/app/components/image/index.html
@@ -0,0 +1,2 @@
+<div class="image">
+</div>
diff --git a/src/app/index.html b/src/app/index.html
index 18c0c6b..b96a445 100644
--- a/src/app/index.html
+++ b/src/app/index.html
@@ -1 +1,2 @@
<app-navbutton></app-navbutton>
+<app-image src="icon.png"></app-image>
diff --git a/src/app/root.zig b/src/app/root.zig
index 5d56b49..d57faf9 100644
--- a/src/app/root.zig
+++ b/src/app/root.zig
@@ -11,6 +11,7 @@ const components = @import("components/root.zig").components;
pub const app: zilch.App(.{
.name = "Memora",
+ .favicon = "icon.png",
.functions = &(zilch.Object.functions ++
zilch.Promise.functions ++
zilch.Callable.functions),
diff --git a/src/app/theme.css b/src/app/theme.css
index 00a1e92..cfe5205 100644
--- a/src/app/theme.css
+++ b/src/app/theme.css
@@ -12,3 +12,8 @@ body {
margin: 0;
overflow: hidden;
}
+
+app-image {
+ display: block;
+ width: 20vw;
+}
diff --git a/src/favicon.png b/src/favicon.png
new file mode 100644
index 0000000..7ff5837
--- /dev/null
+++ b/src/favicon.png
Binary files differ
diff --git a/src/main.zig b/src/main.zig
index cb8c2ad..ec3b2fd 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -13,6 +13,7 @@ const wasm = @embedFile("wasm");
const routes: http.RouteSet = .init(&([_]http.handler.Interface{
http.handler.Static(.index, site.app.html, "text/html").interface(),
http.handler.Static(.{"index.wasm"}, wasm, "application/wasm").interface(),
+ http.handler.Static(.{"icon.png"}, @embedFile("favicon.png"), "image/png").interface(),
}) ++ api.interfaces);
pub fn main(init: std.process.Init) !void {
diff --git a/src/zilch/App/root.zig b/src/zilch/App/root.zig
index c2cc024..a7700d9 100644
--- a/src/zilch/App/root.zig
+++ b/src/zilch/App/root.zig
@@ -9,6 +9,7 @@ const Env = mod.Env;
pub const Options = struct {
name: []const u8,
+ favicon: []const u8,
functions: []const Env.Function,
globals: []const Global,
components: []const Component,
@@ -82,6 +83,7 @@ pub fn App(comptime options: Options) type {
.root = .node("html", .{}, &.{
.node("head", .{}, &.{
.node("title", .{}, &.{.text(options.name)}),
+ .void("link", .{ .rel = "icon", .href = options.favicon }),
.void("meta", .{
.name = "viewport",
.content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0",
@@ -114,7 +116,10 @@ pub fn App(comptime options: Options) type {
}),
};
- html: []const u8 = std.fmt.comptimePrint("{f}", .{node}),
+ html: []const u8 = str: {
+ @setEvalBranchQuota(100_000);
+ break :str std.fmt.comptimePrint("{f}", .{node});
+ },
pub const init: @This() = .{};
};