feat(leptos-v0.7): demo

This commit is contained in:
luoxiao 2024-07-08 12:01:05 +08:00 committed by luoxiaozero
parent 9557637496
commit 27e4e7ebfd
7 changed files with 41 additions and 41 deletions

View file

@ -32,8 +32,8 @@ nightly = ["leptos/nightly", "leptos_router/nightly"]
# https://benw.is/posts/how-i-improved-my-rust-compile-times-by-seventy-five-percent#optimization-level # https://benw.is/posts/how-i-improved-my-rust-compile-times-by-seventy-five-percent#optimization-level
[profile.dev] # [profile.dev]
opt-level = 1 # opt-level = 1
[profile.dev.package."*"] # [profile.dev.package."*"]
opt-level = 3 # opt-level = 3

View file

@ -103,14 +103,14 @@ fn TheRouter(is_routing: RwSignal<bool>) -> impl IntoView {
<Route path=StaticSegment("switch") view=SwitchMdPage/> <Route path=StaticSegment("switch") view=SwitchMdPage/>
} }
} }
// <Route path=StaticSegment("tab-list") view=TabListMdPage/> <Route path=StaticSegment("tab-list") view=TabListMdPage/>
// <Route path=StaticSegment("table") view=TableMdPage/> <Route path=StaticSegment("table") view=TableMdPage/>
// <Route path=StaticSegment("tag") view=TagMdPage/> <Route path=StaticSegment("tag") view=TagMdPage/>
// <Route path=StaticSegment("text") view=TextMdPage/> <Route path=StaticSegment("text") view=TextMdPage/>
// <Route path=StaticSegment("textarea") view=TextareaMdPage/> <Route path=StaticSegment("textarea") view=TextareaMdPage/>
// <Route path=StaticSegment("time-picker") view=TimePickerMdPage/> <Route path=StaticSegment("time-picker") view=TimePickerMdPage/>
// <Route path=StaticSegment("toast") view=ToastMdPage /> <Route path=StaticSegment("toast") view=ToastMdPage />
// <Route path=StaticSegment("upload") view=UploadMdPage/> <Route path=StaticSegment("upload") view=UploadMdPage/>
</ParentRoute> </ParentRoute>
// <Route path="/mobile/tabbar" view=TabbarDemoPage/> // <Route path="/mobile/tabbar" view=TabbarDemoPage/>
// <Route path="/mobile/nav-bar" view=NavBarDemoPage/> // <Route path="/mobile/nav-bar" view=NavBarDemoPage/>

View file

@ -1,5 +1,5 @@
use crate::components::{Demo, DemoCode}; use crate::components::{Demo, DemoCode};
use leptos::prelude::*; use leptos::{ev, prelude::*};
use thaw::*; use thaw::*;
demo_markdown::include_md! {} demo_markdown::include_md! {}

View file

@ -14,13 +14,14 @@ view! {
### Closable ### Closable
```rust demo ```rust demo
let message = use_message(); use send_wrapper::SendWrapper;
let success = move |_| { // let message = use_message();
message.create( let success = move |_: SendWrapper<ev::MouseEvent>| {
"tag close".into(), // message.create(
MessageVariant::Success, // "tag close".into(),
Default::default(), // MessageVariant::Success,
); // Default::default(),
// );
}; };
view! { view! {

View file

@ -3,13 +3,13 @@
```rust demo ```rust demo
use send_wrapper::SendWrapper; use send_wrapper::SendWrapper;
let message = use_message(); // let message = use_message();
let custom_request = move |file_list: SendWrapper<FileList>| { let custom_request = move |file_list: SendWrapper<FileList>| {
message.create( // message.create(
format!("Number of uploaded files: {}", file_list.length()), // format!("Number of uploaded files: {}", file_list.length()),
MessageVariant::Success, // MessageVariant::Success,
Default::default(), // Default::default(),
); // );
}; };
view!{ view!{

View file

@ -65,15 +65,15 @@ pub fn include_md(_token_stream: proc_macro::TokenStream) -> proc_macro::TokenSt
"SpaceMdPage" => "../docs/space/mod.md", "SpaceMdPage" => "../docs/space/mod.md",
"SpinButtonMdPage" => "../docs/spin_button/mod.md", "SpinButtonMdPage" => "../docs/spin_button/mod.md",
"SpinnerMdPage" => "../docs/spinner/mod.md", "SpinnerMdPage" => "../docs/spinner/mod.md",
"SwitchMdPage" => "../docs/switch/mod.md" "SwitchMdPage" => "../docs/switch/mod.md",
// "TabListMdPage" => "../docs/tab_list/mod.md", "TabListMdPage" => "../docs/tab_list/mod.md",
// "TableMdPage" => "../docs/table/mod.md", "TableMdPage" => "../docs/table/mod.md",
// "TagMdPage" => "../docs/tag/mod.md", "TagMdPage" => "../docs/tag/mod.md",
// "TextareaMdPage" => "../docs/textarea/mod.md", "TextMdPage" => "../docs/text/mod.md",
// "TimePickerMdPage" => "../docs/time_picker/mod.md", "TextareaMdPage" => "../docs/textarea/mod.md",
// "TextMdPage" => "../docs/text/mod.md", "TimePickerMdPage" => "../docs/time_picker/mod.md",
// // "ToastMdPage" => "../docs/toast/mod.md", "ToastMdPage" => "../docs/toast/mod.md",
// // "UploadMdPage" => "../docs/upload/mod.md" "UploadMdPage" => "../docs/upload/mod.md"
}; };
let mut fn_list = vec![]; let mut fn_list = vec![];

View file

@ -1,7 +1,7 @@
use crate::Icon; use crate::Icon;
use leptos::{ev, prelude::*}; use leptos::{either::Either, ev, prelude::*};
use thaw_utils::{class_list, mount_style, OptionalProp};
use send_wrapper::SendWrapper; use send_wrapper::SendWrapper;
use thaw_utils::{class_list, mount_style, OptionalProp};
#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] #[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
pub enum TagVariant { pub enum TagVariant {
@ -38,16 +38,15 @@ pub fn Tag(
{move || { {move || {
if closable.get() { if closable.get() {
view! { Either::Left(view! {
<button class="thaw-tag__close" on:click=on_close> <button class="thaw-tag__close" on:click=on_close>
<svg fill="currentColor" aria-hidden="true" width="1em" height="1em" viewBox="0 0 20 20"> <svg fill="currentColor" aria-hidden="true" width="1em" height="1em" viewBox="0 0 20 20">
<path d="m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z" fill="currentColor"></path> <path d="m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z" fill="currentColor"></path>
</svg> </svg>
</button> </button>
} })
.into()
} else { } else {
None Either::Right(())
} }
}} }}