aboutsummaryrefslogtreecommitdiff
path: root/test/examples/svg.gleam
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2023-07-20 23:19:31 +0100
committerHayleigh Thompson <me@hayleigh.dev>2023-07-20 23:19:31 +0100
commit92a42c79a2ef4c5049d77c3bbb8596040d0afdd3 (patch)
treeaacf85a116a24258a8df9ed7bcf4cc3945cc4add /test/examples/svg.gleam
parent9032044a0f35b128bb5f9a4ec65e0fe7a7fd94f6 (diff)
downloadlustre-92a42c79a2ef4c5049d77c3bbb8596040d0afdd3.tar.gz
lustre-92a42c79a2ef4c5049d77c3bbb8596040d0afdd3.zip
:sparkles: Create a separate module for namespaced svg elements.
Diffstat (limited to 'test/examples/svg.gleam')
-rw-r--r--test/examples/svg.gleam49
1 files changed, 20 insertions, 29 deletions
diff --git a/test/examples/svg.gleam b/test/examples/svg.gleam
index 19c7652..1e0e6a2 100644
--- a/test/examples/svg.gleam
+++ b/test/examples/svg.gleam
@@ -3,8 +3,9 @@
import gleam/int
import lustre
import lustre/attribute.{attribute}
-import lustre/element.{Element, namespaced, text}
+import lustre/element.{Element, text}
import lustre/html.{button, div, p, svg}
+import lustre/svg.{path}
import lustre/event
// MAIN ------------------------------------------------------------------------
@@ -69,20 +70,15 @@ fn plus(attrs) {
..attrs
],
[
- namespaced(
- "http://www.w3.org/2000/svg",
- "path",
- [
- attribute(
- "d",
- "M8 2.75C8 2.47386 7.77614 2.25 7.5 2.25C7.22386 2.25 7 2.47386 7 2.75V7H2.75C2.47386 7 2.25 7.22386 2.25 7.5C2.25 7.77614 2.47386 8 2.75 8H7V12.25C7 12.5261 7.22386 12.75 7.5 12.75C7.77614 12.75 8 12.5261 8 12.25V8H12.25C12.5261 8 12.75 7.77614 12.75 7.5C12.75 7.22386 12.5261 7 12.25 7H8V2.75Z",
- ),
- attribute("fill", "currentColor"),
- attribute("fill-rule", "evenodd"),
- attribute("clip-rule", "evenodd"),
- ],
- [],
- ),
+ path([
+ attribute(
+ "d",
+ "M8 2.75C8 2.47386 7.77614 2.25 7.5 2.25C7.22386 2.25 7 2.47386 7 2.75V7H2.75C2.47386 7 2.25 7.22386 2.25 7.5C2.25 7.77614 2.47386 8 2.75 8H7V12.25C7 12.5261 7.22386 12.75 7.5 12.75C7.77614 12.75 8 12.5261 8 12.25V8H12.25C12.5261 8 12.75 7.77614 12.75 7.5C12.75 7.22386 12.5261 7 12.25 7H8V2.75Z",
+ ),
+ attribute("fill", "currentColor"),
+ attribute("fill-rule", "evenodd"),
+ attribute("clip-rule", "evenodd"),
+ ]),
],
)
}
@@ -97,20 +93,15 @@ fn minus(attrs) {
..attrs
],
[
- namespaced(
- "http://www.w3.org/2000/svg",
- "path",
- [
- attribute(
- "d",
- "M2.25 7.5C2.25 7.22386 2.47386 7 2.75 7H12.25C12.5261 7 12.75 7.22386 12.75 7.5C12.75 7.77614 12.5261 8 12.25 8H2.75C2.47386 8 2.25 7.77614 2.25 7.5Z",
- ),
- attribute("fill", "currentColor"),
- attribute("fill-rule", "evenodd"),
- attribute("clip-rule", "evenodd"),
- ],
- [],
- ),
+ path([
+ attribute(
+ "d",
+ "M2.25 7.5C2.25 7.22386 2.47386 7 2.75 7H12.25C12.5261 7 12.75 7.22386 12.75 7.5C12.75 7.77614 12.5261 8 12.25 8H2.75C2.47386 8 2.25 7.77614 2.25 7.5Z",
+ ),
+ attribute("fill", "currentColor"),
+ attribute("fill-rule", "evenodd"),
+ attribute("clip-rule", "evenodd"),
+ ]),
],
)
}