diff --git a/gh-pages/Cargo.toml b/gh-pages/Cargo.toml index 8c08097..33ec338 100644 --- a/gh-pages/Cargo.toml +++ b/gh-pages/Cargo.toml @@ -13,9 +13,9 @@ icondata = { version = "0.0.7", features = [ "AiCheckOutlined", ] } leptos_router = { version = "0.5.0", features = ["csr"] } -indoc = "2.0.1" regex = "1.8.2" leptos_devtools = "0.0.1" +prisms = { git = "https://github.com/luoxiaozero/prisms" } [features] tracing = ["leptos/tracing"] diff --git a/gh-pages/src/components/demo.rs b/gh-pages/src/components/demo.rs index 2d32f3c..0620126 100644 --- a/gh-pages/src/components/demo.rs +++ b/gh-pages/src/components/demo.rs @@ -1,20 +1,23 @@ use leptos::*; -use melt_ui::Code; +use melt_ui::{mount_style, Code}; #[slot] pub struct DemoCode { + #[prop(optional)] + html: &'static str, children: Children, } #[component] pub fn Demo(demo_code: DemoCode, children: Children) -> impl IntoView { + mount_style("demo", || ("", prisms::prism_css!())); view! {
{ children() }
-
+                
                     { (demo_code.children)() }
                 
diff --git a/gh-pages/src/pages/button/mod.rs b/gh-pages/src/pages/button/mod.rs index fba046a..3d3c606 100644 --- a/gh-pages/src/pages/button/mod.rs +++ b/gh-pages/src/pages/button/mod.rs @@ -1,7 +1,7 @@ use crate::components::{Demo, DemoCode}; -use indoc::indoc; use leptos::*; use melt_ui::*; +use prisms::highlight_str; #[component] pub fn ButtonPage() -> impl IntoView { @@ -21,23 +21,21 @@ pub fn ButtonPage() -> impl IntoView { - - { - indoc!(r#" - - - - - "#) - } + + "PRIMARY" + + + + + "#, "rust")> + ""

"color"

@@ -54,23 +52,21 @@ pub fn ButtonPage() -> impl IntoView { - - { - indoc!(r#" - - - - - "#) - } + + "PRIMARY Color" + + + + + "#, "rust")> + ""

"icon"

@@ -80,29 +76,25 @@ pub fn ButtonPage() -> impl IntoView { - - { - indoc! {r#" - - - "#} - } + + "ERROR Color Icon" + + + "#, "rust")> + ""

"style"

- - { - indoc! {r#" - - - "#} - } + "style blue" + + "#, "rust")> + ""
diff --git a/gh-pages/src/pages/checkbox/mod.rs b/gh-pages/src/pages/checkbox/mod.rs index a0f8765..a497fd6 100644 --- a/gh-pages/src/pages/checkbox/mod.rs +++ b/gh-pages/src/pages/checkbox/mod.rs @@ -1,9 +1,9 @@ use std::collections::HashSet; use crate::components::{Demo, DemoCode}; -use indoc::indoc; use leptos::*; use melt_ui::*; +use prisms::highlight_str; #[component] pub fn CheckboxPage() -> impl IntoView { @@ -16,16 +16,14 @@ pub fn CheckboxPage() -> impl IntoView { "Click" - - { - indoc! {r#" - let checked = create_rw_signal(false); + - "Click" - - "#} - } + + "Click" + + "#, "rust")> + ""

"group"

@@ -38,18 +36,16 @@ pub fn CheckboxPage() -> impl IntoView {
"value: " { move || format!("{:?}", value.get()) }
- - { - indoc! {r#" - let value = create_rw_signal(HashSet::new()); + - - - - - "#} - } + + + + + + "#, "rust")> + "" diff --git a/gh-pages/src/pages/image/mod.rs b/gh-pages/src/pages/image/mod.rs index 831daa3..30cd0bc 100644 --- a/gh-pages/src/pages/image/mod.rs +++ b/gh-pages/src/pages/image/mod.rs @@ -1,7 +1,7 @@ use crate::components::{Demo, DemoCode}; -use indoc::indoc; use leptos::*; use melt_ui::*; +use prisms::highlight_str; #[component] pub fn ImagePage() -> impl IntoView { @@ -9,15 +9,13 @@ pub fn ImagePage() -> impl IntoView {

"Image"

- - - - { - indoc! {r#" - - - "#} - } + + + + + "#, "rust")> + ""
diff --git a/gh-pages/src/pages/input/mod.rs b/gh-pages/src/pages/input/mod.rs index 8fa7427..2656311 100644 --- a/gh-pages/src/pages/input/mod.rs +++ b/gh-pages/src/pages/input/mod.rs @@ -1,7 +1,7 @@ use crate::components::{Demo, DemoCode}; -use indoc::indoc; use leptos::*; use melt_ui::*; +use prisms::highlight_str; #[component] pub fn InputPage() -> impl IntoView { @@ -12,15 +12,14 @@ pub fn InputPage() -> impl IntoView { - - { - indoc! {r#" - let value = create_rw_signal(String::from("o")); + - - "#} - } + + + "#, "rust")> + "" + "" diff --git a/gh-pages/src/pages/menu/mod.rs b/gh-pages/src/pages/menu/mod.rs index e714cab..3aa1129 100644 --- a/gh-pages/src/pages/menu/mod.rs +++ b/gh-pages/src/pages/menu/mod.rs @@ -1,7 +1,7 @@ use crate::components::{Demo, DemoCode}; -use indoc::indoc; use leptos::*; use melt_ui::*; +use prisms::highlight_str; #[component] pub fn MenuPage() -> impl IntoView { @@ -14,17 +14,15 @@ pub fn MenuPage() -> impl IntoView { - - { - indoc!(r#" - let selected = create_rw_signal(String::from("o")); - - - - - - "#) - } + + + + + "#, "rust")> + "" diff --git a/gh-pages/src/pages/modal/mod.rs b/gh-pages/src/pages/modal/mod.rs index 38d7244..5f9e906 100644 --- a/gh-pages/src/pages/modal/mod.rs +++ b/gh-pages/src/pages/modal/mod.rs @@ -1,7 +1,7 @@ use crate::components::{Demo, DemoCode}; -use indoc::indoc; use leptos::*; use melt_ui::*; +use prisms::highlight_str; #[component] pub fn ModalPage() -> impl IntoView { @@ -16,19 +16,17 @@ pub fn ModalPage() -> impl IntoView { "hello" - - { - indoc! {r#" - let show = create_rw_signal(false); + - "open modal" - - - "hello" - - "#} - } + + + "hello" + + "#, "rust")> + "" diff --git a/gh-pages/src/pages/nav_bar/mod.rs b/gh-pages/src/pages/nav_bar/mod.rs index c9e30b5..67b457f 100644 --- a/gh-pages/src/pages/nav_bar/mod.rs +++ b/gh-pages/src/pages/nav_bar/mod.rs @@ -2,9 +2,9 @@ use crate::{ components::{Demo, DemoCode}, pages::MobilePage, }; -use indoc::indoc; use leptos::*; use melt_ui::mobile::NavBar; +use prisms::highlight_str; #[component] pub fn NavBarPage() -> impl IntoView { @@ -14,19 +14,17 @@ pub fn NavBarPage() -> impl IntoView {

"Navbar"

"" - - { - indoc!(r#" - - "#) - } + + "#, "rust")> + "" diff --git a/gh-pages/src/pages/select/mod.rs b/gh-pages/src/pages/select/mod.rs index c6e85d3..5cade38 100644 --- a/gh-pages/src/pages/select/mod.rs +++ b/gh-pages/src/pages/select/mod.rs @@ -1,7 +1,7 @@ use crate::components::{Demo, DemoCode}; -use indoc::indoc; use leptos::*; use melt_ui::*; +use prisms::highlight_str; #[component] pub fn SelectPage() -> impl IntoView { @@ -16,18 +16,16 @@ pub fn SelectPage() -> impl IntoView {

"Select"

+ "#, "rust")> + ""
diff --git a/gh-pages/src/pages/slider/mod.rs b/gh-pages/src/pages/slider/mod.rs index 625de3c..c8d1b35 100644 --- a/gh-pages/src/pages/slider/mod.rs +++ b/gh-pages/src/pages/slider/mod.rs @@ -1,7 +1,7 @@ use crate::components::{Demo, DemoCode}; -use indoc::indoc; use leptos::*; use melt_ui::*; +use prisms::highlight_str; #[component] pub fn SliderPage() -> impl IntoView { @@ -12,14 +12,12 @@ pub fn SliderPage() -> impl IntoView {

"Slider"

- - { - indoc!(r#" - let value = create_rw_signal(0.0); + - "#) - } + + "#, "rust")> + "" diff --git a/gh-pages/src/pages/space/mod.rs b/gh-pages/src/pages/space/mod.rs index 969fe82..2e7adec 100644 --- a/gh-pages/src/pages/space/mod.rs +++ b/gh-pages/src/pages/space/mod.rs @@ -1,7 +1,7 @@ use crate::components::{Demo, DemoCode}; -use indoc::indoc; use leptos::*; use melt_ui::*; +use prisms::highlight_str; #[component] pub fn SpacePage() -> impl IntoView { @@ -14,16 +14,14 @@ pub fn SpacePage() -> impl IntoView { - - { - indoc!(r#" - - - - - - "#) - } + + + + + + "#, "rust")> + ""

"gap"

@@ -38,21 +36,19 @@ pub fn SpacePage() -> impl IntoView { - - { - indoc!(r#" - - - - - - - - - - - "#) - } + + + + + + + + + + + "#, "rust")> + "" diff --git a/gh-pages/src/pages/tabbar/mod.rs b/gh-pages/src/pages/tabbar/mod.rs index 8d7e495..3af079b 100644 --- a/gh-pages/src/pages/tabbar/mod.rs +++ b/gh-pages/src/pages/tabbar/mod.rs @@ -2,9 +2,9 @@ use crate::{ components::{Demo, DemoCode}, pages::MobilePage, }; -use indoc::indoc; use leptos::*; use melt_ui::mobile::*; +use prisms::highlight_str; #[component] pub fn TabbarPage() -> impl IntoView { @@ -14,24 +14,22 @@ pub fn TabbarPage() -> impl IntoView {

"Tabbar"

"" - - { - indoc!(r#" - let selected = create_rw_signal(String::from("o")); - - - - "and" - - - "if" - - - "or" - - - "#) - } + + + "and" + + + "if" + + + "or" + + + "#, "rust")> + "" diff --git a/gh-pages/src/pages/tabs/mod.rs b/gh-pages/src/pages/tabs/mod.rs index 623d982..039abbf 100644 --- a/gh-pages/src/pages/tabs/mod.rs +++ b/gh-pages/src/pages/tabs/mod.rs @@ -1,7 +1,7 @@ use crate::components::{Demo, DemoCode}; -use indoc::indoc; use leptos::*; use melt_ui::*; +use prisms::highlight_str; #[component] pub fn TabsPage() -> impl IntoView { @@ -18,20 +18,18 @@ pub fn TabsPage() -> impl IntoView { "pear" - - { - indoc! {r#" - let active_key = create_rw_signal("apple"); - - - "apple" - - - "pear" - - - "#} - } + + + "apple" + + + "pear" + + + "#, "rust")> + "" diff --git a/gh-pages/src/pages/toast/mod.rs b/gh-pages/src/pages/toast/mod.rs index c2f6aef..1680a89 100644 --- a/gh-pages/src/pages/toast/mod.rs +++ b/gh-pages/src/pages/toast/mod.rs @@ -2,10 +2,10 @@ use crate::{ components::{Demo, DemoCode}, pages::MobilePage, }; -use indoc::indoc; use leptos::*; use melt_ui::mobile::*; use melt_ui::*; +use prisms::highlight_str; use std::time::Duration; #[component] @@ -16,19 +16,17 @@ pub fn ToastPage() -> impl IntoView {

"Toast"

"" - - { - indoc!(r#" - let count = create_rw_signal(0u32); - let onclick = move |_| { - show_toast(ToastOptions { - message: format!("Hello {}", count.get_untracked()), - duration: Duration::from_millis(2000), - }); - count.set(count.get_untracked() + 1); - }; - "#) - } + + "" diff --git a/src/lib.rs b/src/lib.rs index e59b885..13a7480 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,4 +38,5 @@ pub use space::*; pub use table::*; pub use tabs::*; pub use theme::Theme; +pub use utils::mount_style::mount_style; pub use wave::*; diff --git a/src/utils/mod.rs b/src/utils/mod.rs index f8a5cd4..f21060a 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1 +1 @@ -pub(crate) mod mount_style; +pub mod mount_style;