Skip to content

Commit a67ca6f

Browse files
🔥 remove index.html files from examples (#456)
* 🔥 remove index.html files from examples * 💄 set titles for examples * 🐛 fix examples that did interesting things in the index.html file.
1 parent 944c79f commit a67ca6f

49 files changed

Lines changed: 184 additions & 499 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/01-basics/01-hello-world/gleam.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ dev-dependencies = { lustre_dev_tools = ">= 2.0.0 and < 3.0.0" }
55
[dependencies]
66
gleam_stdlib = ">= 0.44.0 and < 2.0.0"
77
lustre = { path = "../../../" }
8+
9+
[tools.lustre.html]
10+
title = "01-basics/01-hello-world"

examples/01-basics/01-hello-world/index.html

Lines changed: 0 additions & 16 deletions
This file was deleted.

examples/01-basics/02-attributes/gleam.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ dev-dependencies = { lustre_dev_tools = ">= 2.0.0 and < 3.0.0" }
55
[dependencies]
66
gleam_stdlib = ">= 0.44.0 and < 2.0.0"
77
lustre = { path = "../../../" }
8+
9+
[tools.lustre.html]
10+
title = "01-basics/02-attributes"

examples/01-basics/02-attributes/index.html

Lines changed: 0 additions & 16 deletions
This file was deleted.

examples/01-basics/03-view-functions/gleam.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ dev-dependencies = { lustre_dev_tools = ">= 2.0.0 and < 3.0.0" }
55
[dependencies]
66
gleam_stdlib = ">= 0.44.0 and < 2.0.0"
77
lustre = { path = "../../../" }
8+
9+
[tools.lustre.html]
10+
title = "01-basics/03-view-functions"

examples/01-basics/03-view-functions/index.html

Lines changed: 0 additions & 16 deletions
This file was deleted.

examples/01-basics/04-keyed-elements/gleam.toml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,53 @@ dev-dependencies = { lustre_dev_tools = ">= 2.0.0 and < 3.0.0" }
55
[dependencies]
66
gleam_stdlib = ">= 0.44.0 and < 2.0.0"
77
lustre = { path = "../../../" }
8+
9+
[tools.lustre.html]
10+
title = "01-basics/04-keyed-elements"
11+
12+
[[tools.lustre.html.stylesheets]]
13+
content = """
14+
@keyframes flash {
15+
0% {
16+
outline: 6px solid orangered;
17+
}
18+
100% {
19+
outline: 6px solid transparent;
20+
}
21+
}
22+
23+
.flash {
24+
animation: flash 0.5s ease-out;
25+
}
26+
"""
27+
28+
[[tools.lustre.html.scripts]]
29+
content = """
30+
// This script is used to flash elements when they are modified or
31+
// added to the DOM.
32+
33+
document.addEventListener("DOMContentLoaded", () => {
34+
function flash(node) {
35+
if (node.nodeType === Node.ELEMENT_NODE) {
36+
node.classList.add("flash");
37+
setTimeout(() => node.classList.remove("flash"), 500);
38+
}
39+
}
40+
41+
const observer = new MutationObserver((mutations) => {
42+
for (const mutation of mutations) {
43+
if (mutation.type === "attributes") {
44+
flash(mutation.target);
45+
} else if (mutation.type === "childList") {
46+
mutation.addedNodes.forEach(flash);
47+
}
48+
}
49+
});
50+
51+
observer.observe(document.getElementById("app"), {
52+
attributeFilter: ["src"],
53+
childList: true,
54+
subtree: true,
55+
});
56+
});
57+
"""

examples/01-basics/04-keyed-elements/index.html

Lines changed: 0 additions & 60 deletions
This file was deleted.

examples/01-basics/05-fragments/gleam.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ dev-dependencies = { lustre_dev_tools = ">= 2.0.0 and < 3.0.0" }
55
[dependencies]
66
gleam_stdlib = ">= 0.44.0 and < 2.0.0"
77
lustre = { path = "../../../" }
8+
9+
[tools.lustre.html]
10+
title = "01-basics/05-fragments"

examples/01-basics/05-fragments/index.html

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)