diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index c0555ee7c..5afc0d0f3 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -29,7 +29,7 @@ jobs: # - name: Install CLI # run: cargo binstall dioxus-cli -y --force - name: Install CLI - run: cargo install --force --git https://github.com/DioxusLabs/dioxus dioxus-cli + run: cargo install --force --git https://github.com/DioxusLabs/dioxus dioxus-cli --locked - name: Build run: DIOXUS_LOG=dx=trace dx build --platform web --ssg --profile release-tiny - name: Copy output diff --git a/docs-src/0.5/en/router/reference/history-providers.md b/docs-src/0.5/en/router/reference/history-providers.md index ff6bbe18b..382b4ca44 100644 --- a/docs-src/0.5/en/router/reference/history-providers.md +++ b/docs-src/0.5/en/router/reference/history-providers.md @@ -16,6 +16,6 @@ By default, the router uses the [`MemoryHistory`]. It might be changed to use You can override the default history: ```rust -{{#include src/doc_examples/history_provider.rs:app}} +{{#include src/doc_examples/untested_05/history_provider.rs:app}} ``` diff --git a/src/doc_examples/history_provider.rs b/src/doc_examples/history_provider.rs index 4a13d452d..247af2441 100644 --- a/src/doc_examples/history_provider.rs +++ b/src/doc_examples/history_provider.rs @@ -11,13 +11,17 @@ enum Route { // ANCHOR: app #[component] fn App() -> Element { - rsx! {Router:: { config: || RouterConfig::default().history(WebHistory::default()) }} + rsx! { + Router:: { config: || RouterConfig::default() } + } } // ANCHOR_END: app #[component] fn Home() -> Element { - rsx! { h1 { "Welcome to the Dioxus Blog!" } } + rsx! { + h1 { "Welcome to the Dioxus Blog!" } + } } fn main() {} diff --git a/src/doc_examples/router_cfg.rs b/src/doc_examples/router_cfg.rs index 958295ab9..72a873deb 100644 --- a/src/doc_examples/router_cfg.rs +++ b/src/doc_examples/router_cfg.rs @@ -15,14 +15,18 @@ enum Route { // ANCHOR: app #[component] fn App() -> Element { - rsx! {Router:: { config: || RouterConfig::default().history(WebHistory::default()) }} + rsx! { + Router:: { config: || RouterConfig::default() } + } } // ANCHOR_END: app // ANCHOR: home #[component] fn Home() -> Element { - rsx! { h1 { "Welcome to the Dioxus Blog!" } } + rsx! { + h1 { "Welcome to the Dioxus Blog!" } + } } // ANCHOR_END: home diff --git a/src/doc_examples/untested_05/history_provider.rs b/src/doc_examples/untested_05/history_provider.rs new file mode 100644 index 000000000..4a13d452d --- /dev/null +++ b/src/doc_examples/untested_05/history_provider.rs @@ -0,0 +1,23 @@ +#![allow(non_snake_case)] +use dioxus::prelude::*; +use dioxus_router::prelude::*; + +#[derive(Routable, Clone)] +enum Route { + #[route("/")] + Home {}, +} + +// ANCHOR: app +#[component] +fn App() -> Element { + rsx! {Router:: { config: || RouterConfig::default().history(WebHistory::default()) }} +} +// ANCHOR_END: app + +#[component] +fn Home() -> Element { + rsx! { h1 { "Welcome to the Dioxus Blog!" } } +} + +fn main() {} diff --git a/src/doc_examples/untested_05/router_cfg.rs b/src/doc_examples/untested_05/router_cfg.rs new file mode 100644 index 000000000..958295ab9 --- /dev/null +++ b/src/doc_examples/untested_05/router_cfg.rs @@ -0,0 +1,29 @@ +// ANCHOR: router +#![allow(non_snake_case)] +use dioxus::prelude::*; +use dioxus_router::prelude::*; + +/// An enum of all of the possible routes in the app. +#[derive(Routable, Clone)] +enum Route { + // The home page is at the / route + #[route("/")] + Home {}, +} +// ANCHOR_END: router + +// ANCHOR: app +#[component] +fn App() -> Element { + rsx! {Router:: { config: || RouterConfig::default().history(WebHistory::default()) }} +} +// ANCHOR_END: app + +// ANCHOR: home +#[component] +fn Home() -> Element { + rsx! { h1 { "Welcome to the Dioxus Blog!" } } +} +// ANCHOR_END: home + +fn main() {} diff --git a/src/docs/router_05.rs b/src/docs/router_05.rs index 69bdbfb54..d352a9cbe 100644 --- a/src/docs/router_05.rs +++ b/src/docs/router_05.rs @@ -5219,6 +5219,13 @@ pub fn ReferenceRsx() -> dioxus::prelude::Element { name: "hello_world_desktop.rs".to_string(), } DemoFrame { rsx_overview::ConditionalAttributes {} } + p { + "Repeating an attribute joins the values with a space. This makes it easy to add values like classes conditionally:" + } + CodeBlock { + contents: "
\nlet large_font = true;\nrsx! {{\n    div {{\n        class: "base-class another-class",\n        class: if large_font {{ "text-xl" }},\n        "Hello, World!"\n    }}\n}}
\n", + name: "hello_world_desktop.rs".to_string(), + } h4 { id: "custom-attributes", a { href: "#custom-attributes", class: "header", "Custom Attributes" } }