Skip to content

Commit

Permalink
Update example to use new API
Browse files Browse the repository at this point in the history
  • Loading branch information
ghivert committed Dec 24, 2024
1 parent e8913c7 commit db27065
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions example/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# You typically do not need to edit this file

packages = [
{ name = "gleam_javascript", version = "0.11.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_javascript", source = "hex", outer_checksum = "483631D3001FCE8EB12ADEAD5E1B808440038E96F93DA7A32D326C82F480C0B2" },
{ name = "gleam_stdlib", version = "0.39.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "2D7DE885A6EA7F1D5015D1698920C9BAF7241102836CE0C3837A4F160128A9C4" },
{ name = "gleam_javascript", version = "0.13.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_javascript", source = "hex", outer_checksum = "F98328FCF573DA6F3A35D7F6CB3F9FF19FD5224CCBA9151FCBEAA0B983AF2F58" },
{ name = "gleam_stdlib", version = "0.51.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "14AFA8D3DDD7045203D422715DBB822D1725992A31DF35A08D97389014B74B68" },
{ name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" },
{ name = "redraw", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_javascript", "gleam_stdlib"], source = "local", path = "../redraw" },
{ name = "redraw_dom", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "redraw"], source = "local", path = "../redraw_dom" },
{ name = "redraw", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_javascript", "gleam_stdlib"], source = "local", path = "../redraw" },
{ name = "redraw_dom", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "redraw"], source = "local", path = "../redraw_dom" },
]

[requirements]
Expand Down
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"vite-gleam": "^0.4.3"
},
"devDependencies": {
"@chouqueth/gleam": "^1.3.2",
"@chouqueth/gleam": "^1.6.3",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
Expand Down
14 changes: 7 additions & 7 deletions example/src/main.gleam
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import gleam/int
import gleam/list
import redraw as react
import redraw/attribute as a
import redraw/handler as h
import redraw/html
import redraw_dom/client
import redraw/dom/attribute as a
import redraw/dom/client
import redraw/dom/events
import redraw/dom/html

pub type Root

Expand All @@ -14,8 +14,8 @@ pub type Children

pub fn main() {
let root = root()
client.create_root("root")
|> client.render(react.strict_mode([root()]))
let assert Ok(node) = client.create_root("root")
client.render(node, react.strict_mode([root()]))
}

pub fn root() {
Expand All @@ -31,7 +31,7 @@ pub type CounterProps {
fn counter() {
use props: CounterProps <- react.component_("Counter")
html.button(
[h.on_click(fn(_) { props.set_count(fn(count) { count + 1 }) })],
[events.on_click(fn(_) { props.set_count(fn(count) { count + 1 }) })],
list.map([props.count], fn(count) {
html.text("count is " <> int.to_string(count))
}),
Expand Down
10 changes: 5 additions & 5 deletions example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,15 @@ __metadata:
languageName: node
linkType: hard

"@chouqueth/gleam@npm:^1.3.2":
version: 1.3.2
resolution: "@chouqueth/gleam@npm:1.3.2"
"@chouqueth/gleam@npm:^1.6.3":
version: 1.6.3
resolution: "@chouqueth/gleam@npm:1.6.3"
dependencies:
cachedir: "npm:^2.4.0"
tar: "npm:^7.1.0"
bin:
gleam: bin/cli.mjs
checksum: 10c0/623d66b053375e44fd17b809d85caf9697214cd88826d5b2b17e89569d169ff9180441c88de3b9ec07b72957bba4d4580de9a8cc2354309f568e6bf9e0f61677
checksum: 10c0/1582f7205fc0c56578e71cc80c600a0090c622f7f90012b4fb1a35b4824619695799729792c19218fb8fdfbf1420d11e8ccf67eac50e0388c5df1a2355d72320
languageName: node
linkType: hard

Expand Down Expand Up @@ -2304,7 +2304,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "greact@workspace:."
dependencies:
"@chouqueth/gleam": "npm:^1.3.2"
"@chouqueth/gleam": "npm:^1.6.3"
"@types/react": "npm:^18.3.3"
"@types/react-dom": "npm:^18.3.0"
"@vitejs/plugin-react": "npm:^4.3.1"
Expand Down

0 comments on commit db27065

Please sign in to comment.