From 92a42c79a2ef4c5049d77c3bbb8596040d0afdd3 Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Thu, 20 Jul 2023 23:19:31 +0100 Subject: :sparkles: Create a separate module for namespaced svg elements. --- test/examples/svg.gleam | 49 ++++++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 29 deletions(-) (limited to 'test/examples/svg.gleam') 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"), + ]), ], ) } -- cgit v1.2.3