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
[profile.dev]
opt-level = 1
# [profile.dev]
# opt-level = 1
[profile.dev.package."*"]
opt-level = 3
# [profile.dev.package."*"]
# 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("tab-list") view=TabListMdPage/>
// <Route path=StaticSegment("table") view=TableMdPage/>
// <Route path=StaticSegment("tag") view=TagMdPage/>
// <Route path=StaticSegment("text") view=TextMdPage/>
// <Route path=StaticSegment("textarea") view=TextareaMdPage/>
// <Route path=StaticSegment("time-picker") view=TimePickerMdPage/>
// <Route path=StaticSegment("toast") view=ToastMdPage />
// <Route path=StaticSegment("upload") view=UploadMdPage/>
<Route path=StaticSegment("tab-list") view=TabListMdPage/>
<Route path=StaticSegment("table") view=TableMdPage/>
<Route path=StaticSegment("tag") view=TagMdPage/>
<Route path=StaticSegment("text") view=TextMdPage/>
<Route path=StaticSegment("textarea") view=TextareaMdPage/>
<Route path=StaticSegment("time-picker") view=TimePickerMdPage/>
<Route path=StaticSegment("toast") view=ToastMdPage />
<Route path=StaticSegment("upload") view=UploadMdPage/>
</ParentRoute>
// <Route path="/mobile/tabbar" view=TabbarDemoPage/>
// <Route path="/mobile/nav-bar" view=NavBarDemoPage/>

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
use crate::Icon;
use leptos::{ev, prelude::*};
use thaw_utils::{class_list, mount_style, OptionalProp};
use leptos::{either::Either, ev, prelude::*};
use send_wrapper::SendWrapper;
use thaw_utils::{class_list, mount_style, OptionalProp};
#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
pub enum TagVariant {
@ -38,16 +38,15 @@ pub fn Tag(
{move || {
if closable.get() {
view! {
Either::Left(view! {
<button class="thaw-tag__close" on:click=on_close>
<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>
</svg>
</button>
}
.into()
})
} else {
None
Either::Right(())
}
}}