Skip to content

Commit

Permalink
stable examples change (#2497)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjud authored Apr 5, 2024
1 parent a82af61 commit ca07d29
Show file tree
Hide file tree
Showing 90 changed files with 168 additions and 1,089 deletions.
2 changes: 1 addition & 1 deletion examples/animated_show/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
codegen-units = 1
lto = true

[dependencies]
[dependencies]
leptos = { path = "../../leptos", features = ["csr"] }
console_log = "1"
log = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion examples/counter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ codegen-units = 1
lto = true

[dependencies]
leptos = { path = "../../leptos", features = ["csr", "nightly"] }
leptos = { path = "../../leptos", features = ["csr"] }
console_log = "1"
log = "0.4"
console_error_panic_hook = "0.1.7"
Expand Down
4 changes: 2 additions & 2 deletions examples/counter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ pub fn SimpleCounter(

view! {
<div>
<button on:click=move |_| set_value(0)>"Clear"</button>
<button on:click=move |_| set_value.set(0)>"Clear"</button>
<button on:click=move |_| set_value.update(|value| *value -= step)>"-1"</button>
<span>"Value: " {value} "!"</span>
<span>"Value: " {move || value.get()} "!"</span>
<button on:click=move |_| set_value.update(|value| *value += step)>"+1"</button>
</div>
}
Expand Down
3 changes: 1 addition & 2 deletions examples/counter_isomorphic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ simple_logger = "4.3"
tracing = { version = "0.1", optional = true }

[features]
default = ["nightly"]
hydrate = ["leptos/hydrate", "leptos_meta/hydrate", "leptos_router/hydrate"]
ssr = [
"dep:actix-files",
Expand All @@ -45,7 +44,7 @@ ssr = [
nightly = ["leptos/nightly", "leptos_router/nightly"]

[package.metadata.cargo-all-features]
denylist = ["actix-files", "actix-web", "leptos_actix", "nightly"]
denylist = ["actix-files", "actix-web", "leptos_actix"]
skip_feature_sets = [["ssr", "hydrate"]]

[package.metadata.leptos]
Expand Down
2 changes: 1 addition & 1 deletion examples/counters/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
leptos = { path = "../../leptos", features = ["csr", "nightly"] }
leptos = { path = "../../leptos", features = ["csr"] }
log = "0.4"
console_log = "1"
console_error_panic_hook = "0.1.7"
Expand Down
13 changes: 7 additions & 6 deletions examples/counters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ pub fn Counters() -> impl IntoView {
provide_context(CounterUpdater { set_counters });

let add_counter = move |_| {
let id = next_counter_id();
let id = next_counter_id.get();
let sig = create_signal(0);
set_counters.update(move |counters| counters.push((id, sig)));
set_next_counter_id.update(|id| *id += 1);
};

let add_many_counters = move |_| {
let next_id = next_counter_id();
let next_id = next_counter_id.get();
let new_counters = (next_id..next_id + MANY_COUNTERS).map(|id| {
let signal = create_signal(0);
(id, signal)
Expand Down Expand Up @@ -53,17 +53,17 @@ pub fn Counters() -> impl IntoView {
<span>{move ||
counters.get()
.iter()
.map(|(_, (count, _))| count())
.map(|(_, (count, _))| count.get())
.sum::<i32>()
.to_string()
}</span>
" from "
<span>{move || counters().len().to_string()}</span>
<span>{move || counters.get().len().to_string()}</span>
" counters."
</p>
<ul>
<For
each=counters
each=move||counters.get()
key=|counter| counter.0
children=move |(id, (value, set_value)): (usize, (ReadSignal<i32>, WriteSignal<i32>))| {
view! {
Expand All @@ -85,7 +85,8 @@ fn Counter(
let CounterUpdater { set_counters } = use_context().unwrap();

let input = move |ev| {
set_value(event_target_value(&ev).parse::<i32>().unwrap_or_default())
set_value
.set(event_target_value(&ev).parse::<i32>().unwrap_or_default())
};

// this will run when the scope is disposed, i.e., when this row is deleted
Expand Down
20 changes: 0 additions & 20 deletions examples/counters_stable/.gitignore

This file was deleted.

28 changes: 0 additions & 28 deletions examples/counters_stable/Cargo.toml

This file was deleted.

18 changes: 0 additions & 18 deletions examples/counters_stable/Makefile.toml

This file was deleted.

11 changes: 0 additions & 11 deletions examples/counters_stable/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions examples/counters_stable/e2e/.gitignore

This file was deleted.

83 changes: 0 additions & 83 deletions examples/counters_stable/e2e/package-lock.json

This file was deleted.

7 changes: 0 additions & 7 deletions examples/counters_stable/e2e/package.json

This file was deleted.

77 changes: 0 additions & 77 deletions examples/counters_stable/e2e/playwright.config.ts

This file was deleted.

19 changes: 0 additions & 19 deletions examples/counters_stable/e2e/tests/add_1k_counters.spec.ts

This file was deleted.

15 changes: 0 additions & 15 deletions examples/counters_stable/e2e/tests/add_counter.spec.ts

This file was deleted.

Loading

0 comments on commit ca07d29

Please sign in to comment.