aboutsummaryrefslogtreecommitdiff
path: root/examples/svg
diff options
context:
space:
mode:
Diffstat (limited to 'examples/svg')
-rw-r--r--examples/svg/gleam.toml7
-rw-r--r--examples/svg/manifest.toml15
-rw-r--r--examples/svg/src/svg.gleam103
3 files changed, 0 insertions, 125 deletions
diff --git a/examples/svg/gleam.toml b/examples/svg/gleam.toml
deleted file mode 100644
index b755f57..0000000
--- a/examples/svg/gleam.toml
+++ /dev/null
@@ -1,7 +0,0 @@
-name = "svg"
-version = "1.0.0"
-target = "javascript"
-
-[dependencies]
-gleam_stdlib = "~> 0.34"
-lustre = { path = "../../" } \ No newline at end of file
diff --git a/examples/svg/manifest.toml b/examples/svg/manifest.toml
deleted file mode 100644
index 1c72364..0000000
--- a/examples/svg/manifest.toml
+++ /dev/null
@@ -1,15 +0,0 @@
-# This file was generated by Gleam
-# You typically do not need to edit this file
-
-packages = [
- { name = "gleam_erlang", version = "0.24.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "26BDB52E61889F56A291CB34167315780EE4AA20961917314446542C90D1C1A0" },
- { name = "gleam_json", version = "0.7.0", build_tools = ["gleam"], requirements = ["thoas", "gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "CB405BD93A8828BCD870463DE29375E7B2D252D9D124C109E5B618AAC00B86FC" },
- { name = "gleam_otp", version = "0.9.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "5FADBBEC5ECF3F8B6BE91101D432758503192AE2ADBAD5602158977341489F71" },
- { name = "gleam_stdlib", version = "0.34.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "1FB8454D2991E9B4C0C804544D8A9AD0F6184725E20D63C3155F0AEB4230B016" },
- { name = "lustre", version = "3.1.1", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib"], source = "local", path = "../.." },
- { name = "thoas", version = "0.4.1", build_tools = ["rebar3"], requirements = [], otp_app = "thoas", source = "hex", outer_checksum = "4918D50026C073C4AB1388437132C77A6F6F7C8AC43C60C13758CC0ADCE2134E" },
-]
-
-[requirements]
-gleam_stdlib = { version = "~> 0.34" }
-lustre = { path = "../../" }
diff --git a/examples/svg/src/svg.gleam b/examples/svg/src/svg.gleam
deleted file mode 100644
index 93be5e3..0000000
--- a/examples/svg/src/svg.gleam
+++ /dev/null
@@ -1,103 +0,0 @@
-// IMPORTS ---------------------------------------------------------------------
-
-import gleam/int
-import lustre
-import lustre/attribute.{attribute}
-import lustre/element.{type Element, text}
-import lustre/element/html.{button, div, p, svg}
-import lustre/element/svg.{path}
-import lustre/event
-
-// MAIN ------------------------------------------------------------------------
-
-pub fn main() {
- // A `simple` lustre application doesn't produce `Effect`s. These are best to
- // start with if you're just getting started with lustre or you know you don't
- // need the runtime to manage any side effects.
- let app = lustre.simple(init, update, view)
- let assert Ok(_) = lustre.start(app, "[data-lustre-app]", Nil)
-}
-
-// MODEL -----------------------------------------------------------------------
-
-pub type Model =
- Int
-
-pub fn init(_) -> Model {
- 0
-}
-
-// UPDATE ----------------------------------------------------------------------
-
-pub opaque type Msg {
- Incr
- Decr
- Reset
-}
-
-pub fn update(model: Model, msg: Msg) -> Model {
- case msg {
- Incr -> model + 1
- Decr -> model - 1
- Reset -> 0
- }
-}
-
-// VIEW ------------------------------------------------------------------------
-
-pub fn view(model: Model) -> Element(Msg) {
- div([], [
- button([event.on_click(Incr)], [
- plus([attribute.style([#("color", "red")])]),
- ]),
- button([event.on_click(Decr)], [minus([])]),
- button([event.on_click(Reset)], [text("Reset")]),
- p([], [text(int.to_string(model))]),
- ])
-}
-
-fn plus(attrs) {
- svg(
- [
- attribute("width", "15"),
- attribute("height", "15"),
- attribute("viewBox", "0 0 15 15"),
- attribute("fill", "none"),
- ..attrs
- ],
- [
- 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"),
- ]),
- ],
- )
-}
-
-fn minus(attrs) {
- svg(
- [
- attribute("width", "15"),
- attribute("height", "15"),
- attribute("viewBox", "0 0 15 15"),
- attribute("fill", "none"),
- ..attrs
- ],
- [
- 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"),
- ]),
- ],
- )
-}