aboutsummaryrefslogtreecommitdiff
path: root/src/app/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/components')
-rw-r--r--src/app/components/hello/index.css12
-rw-r--r--src/app/components/hello/index.html3
-rw-r--r--src/app/components/hello/root.zig35
-rw-r--r--src/app/components/navbutton/index.css9
-rw-r--r--src/app/components/navbutton/index.html2
-rw-r--r--src/app/components/navbutton/root.zig16
-rw-r--r--src/app/components/root.zig5
7 files changed, 32 insertions, 50 deletions
diff --git a/src/app/components/hello/index.css b/src/app/components/hello/index.css
deleted file mode 100644
index 7b316cb..0000000
--- a/src/app/components/hello/index.css
+++ /dev/null
@@ -1,12 +0,0 @@
-div {
- font-family: 'sans-serif';
- cursor: pointer;
- user-select: none;
- background: var(--background);
- color: var(--color);
- display: block;
- width: fit-content;
- padding: 10px 10px;
- border-radius: 4px;
- margin: 4px;
-}
diff --git a/src/app/components/hello/index.html b/src/app/components/hello/index.html
deleted file mode 100644
index 6d19662..0000000
--- a/src/app/components/hello/index.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<div onclick="@clicked">
- click me!
-</div>
diff --git a/src/app/components/hello/root.zig b/src/app/components/hello/root.zig
deleted file mode 100644
index 6dafd98..0000000
--- a/src/app/components/hello/root.zig
+++ /dev/null
@@ -1,35 +0,0 @@
-const std = @import("std");
-const z = @import("z");
-
-const Self = @This();
-
-pub const component: z.Component = .{
- .name = "hello",
- .html = .parse(@embedFile("index.html")),
- .css = @embedFile("index.css"),
- .link = @This(),
-};
-
-element: *z.Object,
-counter: usize,
-
-pub fn init(self: *Self, element: *z.Object) void {
- self.element = element;
- self.counter = 0;
-}
-
-pub fn clicked(self: *Self, event: *z.Object) !void {
- var env: z.Env = .init(std.heap.wasm_allocator);
- defer env.deinit();
-
- self.counter += 1;
-
- const x = event.get(&env, "x");
- const y = event.get(&env, "y");
-
- std.log.info("clicked {} times at ({}, {})", .{
- self.counter,
- try x.await(&env, .uint),
- try y.await(&env, .uint),
- });
-}
diff --git a/src/app/components/navbutton/index.css b/src/app/components/navbutton/index.css
new file mode 100644
index 0000000..bf1b4ee
--- /dev/null
+++ b/src/app/components/navbutton/index.css
@@ -0,0 +1,9 @@
+#button {
+ position: absolute;
+ bottom: 10px;
+ right: 10px;
+ width: 50px;
+ height: 50px;
+ background: var(--primary);
+ border-radius: 100%;
+}
diff --git a/src/app/components/navbutton/index.html b/src/app/components/navbutton/index.html
new file mode 100644
index 0000000..ab23160
--- /dev/null
+++ b/src/app/components/navbutton/index.html
@@ -0,0 +1,2 @@
+<div id="button">
+</div>
diff --git a/src/app/components/navbutton/root.zig b/src/app/components/navbutton/root.zig
new file mode 100644
index 0000000..0040c9d
--- /dev/null
+++ b/src/app/components/navbutton/root.zig
@@ -0,0 +1,16 @@
+const z = @import("z");
+
+const Self = @This();
+
+pub const component: z.Component = .{
+ .name = "navbutton",
+ .html = .parse(@embedFile("index.html")),
+ .css = @embedFile("index.css"),
+ .link = @This(),
+};
+
+element: *z.Object,
+
+pub fn init(self: *Self, element: *z.Object) void {
+ self.element = element;
+}
diff --git a/src/app/components/root.zig b/src/app/components/root.zig
new file mode 100644
index 0000000..32ed436
--- /dev/null
+++ b/src/app/components/root.zig
@@ -0,0 +1,5 @@
+const z = @import("z");
+
+pub const components: []const z.Component = &.{
+ @import("navbutton/root.zig").component,
+};