diff --git a/demo/src/app.rs b/demo/src/app.rs index f0c6445..94783a2 100644 --- a/demo/src/app.rs +++ b/demo/src/app.rs @@ -44,9 +44,7 @@ fn TheRouter(is_routing: RwSignal) -> impl IntoView { - - diff --git a/demo/src/pages/components.rs b/demo/src/pages/components.rs index 6c7de93..e7e75f9 100644 --- a/demo/src/pages/components.rs +++ b/demo/src/pages/components.rs @@ -105,31 +105,20 @@ pub(crate) fn gen_menu_data() -> Vec { label: "Installation".into(), }, MenuItemOption { - value: "/guide/usage".into(), - label: "Usage".into(), - }, - ], - }, - MenuGroupOption { - label: "Guides".into(), - children: vec![MenuItemOption { - value: "/guide/server-sider-rendering".into(), - label: "Server Sider Rendering".into(), - }], - }, - MenuGroupOption { - label: "Development".into(), - children: vec![ - MenuItemOption { - value: "/guide/development/guide".into(), - label: "Guide".into(), - }, - MenuItemOption { - value: "/guide/development/components".into(), - label: "Components".into(), + value: "/guide/server-sider-rendering".into(), + label: "Server Sider Rendering".into(), }, ], }, + // MenuGroupOption { + // label: "Development".into(), + // children: vec![ + // MenuItemOption { + // value: "/guide/development/components".into(), + // label: "Components".into(), + // }, + // ], + // }, MenuGroupOption { label: "Components".into(), children: vec![ diff --git a/demo_markdown/docs/_guide/development/guide.md b/demo_markdown/docs/_guide/development/guide.md deleted file mode 100644 index 34c091f..0000000 --- a/demo_markdown/docs/_guide/development/guide.md +++ /dev/null @@ -1,16 +0,0 @@ -# Development guide - -### Code style - -It is recommended to use the Rust style instead of the functional style in the newly added reactive code. - -```rust -RwSignal::new(12) // ✅ -create_rw_signal(12) // 🙅 - -Memo::new(|_| {}) // ✅ -create_memo(|_| {}) // 🙅 - -Effect::new(|_| {}) // ✅ -create_effect(|_| {}) // 🙅 -``` \ No newline at end of file diff --git a/demo_markdown/docs/_guide/installation.md b/demo_markdown/docs/_guide/installation.md index 0b55806..e23035c 100644 --- a/demo_markdown/docs/_guide/installation.md +++ b/demo_markdown/docs/_guide/installation.md @@ -1,7 +1,38 @@ -# Installation +## Installation Installation thaw ```shell cargo add thaw --features=csr ``` + +## Usage + +You just need to import thaw and use it. + +```rust +// Import all +use thaw::*; +// Import on Demand +use thaw::{Button, ButtonAppearance}; +``` + +A small example: + +```rust +use leptos::prelude::*; +use thaw::*; + +fn main() { + mount_to_body(App); +} + +#[component] +pub fn App() -> impl IntoView { + view! { + + } +} +``` \ No newline at end of file diff --git a/demo_markdown/docs/_guide/usage.md b/demo_markdown/docs/_guide/usage.md deleted file mode 100644 index 897315b..0000000 --- a/demo_markdown/docs/_guide/usage.md +++ /dev/null @@ -1,28 +0,0 @@ -# Usage - -You just need to import thaw and use it. - -```rust -// Import all -use thaw::*; -// Import on Demand -use thaw::{Button, ButtonVariant}; -``` - -A small example: - -```rust -use leptos::*; -use thaw::*; - -fn main() { - mount_to_body(App); -} - -#[component] -pub fn App() -> impl IntoView { - view! { - - } -} -``` diff --git a/demo_markdown/src/lib.rs b/demo_markdown/src/lib.rs index fd26645..edebaf9 100644 --- a/demo_markdown/src/lib.rs +++ b/demo_markdown/src/lib.rs @@ -21,10 +21,8 @@ macro_rules! file_path { pub fn include_md(_token_stream: proc_macro::TokenStream) -> proc_macro::TokenStream { let file_list = file_path! { "DevelopmentComponentsMdPage" => "../docs/_guide/development/components.md", - "DevelopmentGuideMdPage" => "../docs/_guide/development/guide.md", "InstallationMdPage" => "../docs/_guide/installation.md", "ServerSiderRenderingMdPage" => "../docs/_guide/server_sider_rendering.md", - "UsageMdPage" => "../docs/_guide/usage.md", // "NavBarMdPage" => "../docs/_mobile/nav_bar/mod.md", // "TabbarMdPage" => "../docs/_mobile/tabbar/mod.md", // "ToastMdPage" => "../docs/_mobile/toast/mod.md", diff --git a/thaw_components/src/lib.rs b/thaw_components/src/lib.rs index cf1c3cf..5f034f6 100644 --- a/thaw_components/src/lib.rs +++ b/thaw_components/src/lib.rs @@ -4,7 +4,6 @@ mod focus_trap; mod if_comp; mod option_comp; mod teleport; -mod wave; pub use binder::{Binder, Follower, FollowerPlacement, FollowerWidth}; pub use css_transition::CSSTransition; @@ -12,7 +11,6 @@ pub use focus_trap::FocusTrap; pub use if_comp::{ElseIf, If, Then}; pub use option_comp::OptionComp; pub use teleport::Teleport; -pub use wave::{Wave, WaveRef}; use leptos::prelude::{slot, ChildrenFn}; diff --git a/thaw_components/src/wave/mod.rs b/thaw_components/src/wave/mod.rs deleted file mode 100644 index d2c9640..0000000 --- a/thaw_components/src/wave/mod.rs +++ /dev/null @@ -1,57 +0,0 @@ -use leptos::{html, leptos_dom::helpers::TimeoutHandle, prelude::*}; -use std::time::Duration; -use thaw_utils::{mount_style, ComponentRef}; - -#[derive(Clone)] -pub struct WaveRef { - play: Callback<()>, -} - -impl WaveRef { - pub fn play(&self) { - self.play.call(()); - } -} - -#[component] -pub fn Wave(#[prop(optional)] comp_ref: ComponentRef) -> impl IntoView { - mount_style("wave", include_str!("./wave.css")); - let wave_ref = NodeRef::::new(); - let animation_timeout_handle = RwSignal::new(None::); - let play = Callback::new(move |_: ()| { - if let Some(handle) = animation_timeout_handle.get() { - handle.clear(); - animation_timeout_handle.set(None); - } - if let Some(wave_ref) = wave_ref.get() { - _ = wave_ref.offset_height(); - } - let handle = set_timeout_with_handle( - move || { - animation_timeout_handle.set(None); - }, - Duration::from_secs(1), - ); - if let Ok(handle) = handle { - animation_timeout_handle.set(Some(handle)) - } - }); - comp_ref.load(WaveRef { play }); - on_cleanup(move || { - if let Some(handle) = animation_timeout_handle.get() { - handle.clear(); - animation_timeout_handle.set(None); - } - }); - view! { -
- } -} diff --git a/thaw_components/src/wave/wave.css b/thaw_components/src/wave/wave.css deleted file mode 100644 index 9343c94..0000000 --- a/thaw_components/src/wave/wave.css +++ /dev/null @@ -1,8 +0,0 @@ -.thaw-wave { - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - border-radius: inherit; -}