mirror of
https://github.com/adoyle0/thaw.git
synced 2025-01-23 06:19:22 -05:00
Fix/ci nightly (#45)
* demo: Modify button click * fix: ci run nightly * pref: fmt and clippy
This commit is contained in:
parent
1fc89b2f14
commit
e9778b6008
15 changed files with 61 additions and 77 deletions
|
@ -117,7 +117,7 @@ pub fn SiteHeader() -> impl IntoView {
|
||||||
icon=icondata::AiIcon::AiGithubOutlined
|
icon=icondata::AiIcon::AiGithubOutlined
|
||||||
round=true
|
round=true
|
||||||
style="font-size: 22px; padding: 0px 6px;"
|
style="font-size: 22px; padding: 0px 6px;"
|
||||||
on:click=move |_| {
|
on_click=move |_| {
|
||||||
_ = window().open_with_url("http://github.com/thaw-ui/thaw");
|
_ = window().open_with_url("http://github.com/thaw-ui/thaw");
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -136,18 +136,10 @@ pub fn ButtonPage() -> impl IntoView {
|
||||||
<h3>"Size"</h3>
|
<h3>"Size"</h3>
|
||||||
<Demo>
|
<Demo>
|
||||||
<Space>
|
<Space>
|
||||||
<Button size=ButtonSize::Tiny>
|
<Button size=ButtonSize::Tiny>"Primary"</Button>
|
||||||
"Primary"
|
<Button size=ButtonSize::Small>"Primary"</Button>
|
||||||
</Button>
|
<Button size=ButtonSize::Medium>"Primary"</Button>
|
||||||
<Button size=ButtonSize::Small>
|
<Button size=ButtonSize::Large>"Primary"</Button>
|
||||||
"Primary"
|
|
||||||
</Button>
|
|
||||||
<Button size=ButtonSize::Medium>
|
|
||||||
"Primary"
|
|
||||||
</Button>
|
|
||||||
<Button size=ButtonSize::Large>
|
|
||||||
"Primary"
|
|
||||||
</Button>
|
|
||||||
</Space>
|
</Space>
|
||||||
<DemoCode slot>
|
<DemoCode slot>
|
||||||
|
|
||||||
|
@ -177,26 +169,14 @@ pub fn ButtonPage() -> impl IntoView {
|
||||||
<Demo>
|
<Demo>
|
||||||
<Space>
|
<Space>
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<Button variant=ButtonVariant::Solid>
|
<Button variant=ButtonVariant::Solid>"Solid"</Button>
|
||||||
"Solid"
|
<Button variant=ButtonVariant::Solid>"Solid"</Button>
|
||||||
</Button>
|
<Button variant=ButtonVariant::Solid>"Solid"</Button>
|
||||||
<Button variant=ButtonVariant::Solid>
|
|
||||||
"Solid"
|
|
||||||
</Button>
|
|
||||||
<Button variant=ButtonVariant::Solid>
|
|
||||||
"Solid"
|
|
||||||
</Button>
|
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
<ButtonGroup vertical=true>
|
<ButtonGroup vertical=true>
|
||||||
<Button variant=ButtonVariant::Solid>
|
<Button variant=ButtonVariant::Solid>"Solid"</Button>
|
||||||
"Solid"
|
<Button variant=ButtonVariant::Solid>"Solid"</Button>
|
||||||
</Button>
|
<Button variant=ButtonVariant::Solid>"Solid"</Button>
|
||||||
<Button variant=ButtonVariant::Solid>
|
|
||||||
"Solid"
|
|
||||||
</Button>
|
|
||||||
<Button variant=ButtonVariant::Solid>
|
|
||||||
"Solid"
|
|
||||||
</Button>
|
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</Space>
|
</Space>
|
||||||
<DemoCode slot>
|
<DemoCode slot>
|
||||||
|
|
|
@ -24,7 +24,7 @@ pub fn Home() -> impl IntoView {
|
||||||
}>"Read the docs"</Button>
|
}>"Read the docs"</Button>
|
||||||
<Button
|
<Button
|
||||||
variant=ButtonVariant::Text
|
variant=ButtonVariant::Text
|
||||||
on:click=move |_| {
|
on_click=move |_| {
|
||||||
_ = window().open_with_url("http://github.com/thaw-ui/thaw");
|
_ = window().open_with_url("http://github.com/thaw-ui/thaw");
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
|
@ -6,15 +6,15 @@ use thaw::*;
|
||||||
#[component]
|
#[component]
|
||||||
pub fn LoadingBarPage() -> impl IntoView {
|
pub fn LoadingBarPage() -> impl IntoView {
|
||||||
let loading_bar = use_loading_bar();
|
let loading_bar = use_loading_bar();
|
||||||
let start = move |_| {
|
let start = Callback::new(move |_| {
|
||||||
loading_bar.start();
|
loading_bar.start();
|
||||||
};
|
});
|
||||||
let finish = move |_| {
|
let finish = Callback::new(move |_| {
|
||||||
loading_bar.finish();
|
loading_bar.finish();
|
||||||
};
|
});
|
||||||
let error = move |_| {
|
let error = Callback::new(move |_| {
|
||||||
loading_bar.error();
|
loading_bar.error();
|
||||||
};
|
});
|
||||||
view! {
|
view! {
|
||||||
<div style="width: 896px; margin: 0 auto;">
|
<div style="width: 896px; margin: 0 auto;">
|
||||||
<h1>"Loading Bar"</h1>
|
<h1>"Loading Bar"</h1>
|
||||||
|
|
|
@ -31,9 +31,9 @@ pub fn MessagePage() -> impl IntoView {
|
||||||
</Alert>
|
</Alert>
|
||||||
<Demo>
|
<Demo>
|
||||||
<Space>
|
<Space>
|
||||||
<Button on:click=success>"Success"</Button>
|
<Button on_click=success>"Success"</Button>
|
||||||
<Button on:click=warning>"Warning"</Button>
|
<Button on_click=warning>"Warning"</Button>
|
||||||
<Button on:click=error>"Error"</Button>
|
<Button on_click=error>"Error"</Button>
|
||||||
</Space>
|
</Space>
|
||||||
<DemoCode slot>
|
<DemoCode slot>
|
||||||
|
|
||||||
|
@ -59,9 +59,9 @@ pub fn MessagePage() -> impl IntoView {
|
||||||
};
|
};
|
||||||
view! {
|
view! {
|
||||||
<Space>
|
<Space>
|
||||||
<Button on:click=success>"Success"</Button>
|
<Button on_click=success>"Success"</Button>
|
||||||
<Button on:click=warning>"Warning"</Button>
|
<Button on_click=warning>"Warning"</Button>
|
||||||
<Button on:click=error>"Error"</Button>
|
<Button on_click=error>"Error"</Button>
|
||||||
</Space>
|
</Space>
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
|
|
|
@ -10,7 +10,7 @@ pub fn ModalPage() -> impl IntoView {
|
||||||
<div style="width: 896px; margin: 0 auto;">
|
<div style="width: 896px; margin: 0 auto;">
|
||||||
<h1>"Modal"</h1>
|
<h1>"Modal"</h1>
|
||||||
<Demo>
|
<Demo>
|
||||||
<Button on:click=move |_| show.set(true)>"Open Modal"</Button>
|
<Button on_click=move |_| show.set(true)>"Open Modal"</Button>
|
||||||
<Modal title="title" show>
|
<Modal title="title" show>
|
||||||
"hello"
|
"hello"
|
||||||
</Modal>
|
</Modal>
|
||||||
|
@ -20,7 +20,7 @@ pub fn ModalPage() -> impl IntoView {
|
||||||
r#"
|
r#"
|
||||||
let show = create_rw_signal(false);
|
let show = create_rw_signal(false);
|
||||||
|
|
||||||
<Button on:click=move |_| show.set(true)>
|
<Button on_click=move |_| show.set(true)>
|
||||||
"open modal"
|
"open modal"
|
||||||
</Button>
|
</Button>
|
||||||
<Modal title="title" show>
|
<Modal title="title" show>
|
||||||
|
|
|
@ -41,7 +41,9 @@ pub fn TimePickerPage() -> impl IntoView {
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>"value"</td>
|
<td>"value"</td>
|
||||||
<td><Text code=true>"RwSignal<Time>"</Text></td>
|
<td>
|
||||||
|
<Text code=true>"RwSignal<Time>"</Text>
|
||||||
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -93,7 +93,7 @@ pub fn ToastDemoPage() -> impl IntoView {
|
||||||
};
|
};
|
||||||
view! {
|
view! {
|
||||||
<div style="margin: 20px">
|
<div style="margin: 20px">
|
||||||
<Button on:click=onclick>"hi"</Button>
|
<Button on_click=onclick>"hi"</Button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ pub fn AutoComplete(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let key = event.key();
|
let key = event.key();
|
||||||
if key == "ArrowDown".to_string() {
|
if key == *"ArrowDown" {
|
||||||
select_option_index.update(|index| {
|
select_option_index.update(|index| {
|
||||||
if *index == options.with_untracked(|options| options.len()) - 1 {
|
if *index == options.with_untracked(|options| options.len()) - 1 {
|
||||||
*index = 0
|
*index = 0
|
||||||
|
@ -83,7 +83,7 @@ pub fn AutoComplete(
|
||||||
*index += 1
|
*index += 1
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if key == "ArrowUp".to_string() {
|
} else if key == *"ArrowUp" {
|
||||||
select_option_index.update(|index| {
|
select_option_index.update(|index| {
|
||||||
if *index == 0 {
|
if *index == 0 {
|
||||||
*index = options.with_untracked(|options| options.len()) - 1;
|
*index = options.with_untracked(|options| options.len()) - 1;
|
||||||
|
@ -91,7 +91,7 @@ pub fn AutoComplete(
|
||||||
*index -= 1
|
*index -= 1
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if key == "Enter".to_string() {
|
} else if key == *"Enter" {
|
||||||
let option_value = options.with_untracked(|options| {
|
let option_value = options.with_untracked(|options| {
|
||||||
let index = select_option_index.get_untracked();
|
let index = select_option_index.get_untracked();
|
||||||
if options.len() > index {
|
if options.len() > index {
|
||||||
|
@ -175,6 +175,7 @@ pub fn AutoComplete(
|
||||||
"thaw-auto-complete__menu-item--selected",
|
"thaw-auto-complete__menu-item--selected",
|
||||||
move || index == select_option_index.get(),
|
move || index == select_option_index.get(),
|
||||||
)
|
)
|
||||||
|
|
||||||
on:click=on_click
|
on:click=on_click
|
||||||
on:mousedown=on_mousedown
|
on:mousedown=on_mousedown
|
||||||
on:mouseenter=on_mouseenter
|
on:mouseenter=on_mouseenter
|
||||||
|
|
|
@ -121,8 +121,7 @@ pub fn Calendar(#[prop(optional, into)] value: RwSignal<Option<NaiveDate>>) -> i
|
||||||
show_date
|
show_date
|
||||||
.with(|date| {
|
.with(|date| {
|
||||||
format!(
|
format!(
|
||||||
"{} {}",
|
"{} {}", Month::try_from(date.month() as u8).unwrap().name(),
|
||||||
Month::try_from(date.month() as u8).unwrap().name(),
|
|
||||||
date.year(),
|
date.year(),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -175,11 +174,11 @@ fn CalendarItem(
|
||||||
let date = date.clone();
|
let date = date.clone();
|
||||||
move |_| value.with(|value_date| value_date.as_ref() == Some(date.deref()))
|
move |_| value.with(|value_date| value_date.as_ref() == Some(date.deref()))
|
||||||
});
|
});
|
||||||
let weekday_str = vec!["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
let weekday_str = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
||||||
let on_click = {
|
let on_click = {
|
||||||
let date = date.clone();
|
let date = date.clone();
|
||||||
move |_| {
|
move |_| {
|
||||||
value.set(Some(date.deref().clone()));
|
value.set(Some(*date.deref()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
view! {
|
view! {
|
||||||
|
|
|
@ -174,9 +174,8 @@ fn ColorPanel(hue: ReadSignal<u16>, sv: RwSignal<(f64, f64)>) -> impl IntoView {
|
||||||
class="thaw-color-picker-popover__handle"
|
class="thaw-color-picker-popover__handle"
|
||||||
style=move || {
|
style=move || {
|
||||||
format!(
|
format!(
|
||||||
"left: calc({}% - 6px); bottom: calc({}% - 6px)",
|
"left: calc({}% - 6px); bottom: calc({}% - 6px)", sv.get().0 * 100.0, sv
|
||||||
sv.get().0 * 100.0,
|
.get().1 * 100.0,
|
||||||
sv.get().1 * 100.0,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
|
@ -24,8 +24,7 @@ pub fn MessageProvider(children: Children) -> impl IntoView {
|
||||||
<Provider value=MessageInjection::new(
|
<Provider value=MessageInjection::new(
|
||||||
message_list,
|
message_list,
|
||||||
)>
|
)>
|
||||||
{children()}
|
{children()} <Teleport>
|
||||||
<Teleport>
|
|
||||||
<div class="thaw-message-container">
|
<div class="thaw-message-container">
|
||||||
<For
|
<For
|
||||||
each=move || message_list.get()
|
each=move || message_list.get()
|
||||||
|
|
|
@ -86,9 +86,8 @@ pub fn Slider(
|
||||||
class="thaw-slider-handle"
|
class="thaw-slider-handle"
|
||||||
style=move || {
|
style=move || {
|
||||||
format!(
|
format!(
|
||||||
"left: {}%; transform: translateX(-{}%)",
|
"left: {}%; transform: translateX(-{}%)", percentage.get(), percentage
|
||||||
percentage.get(),
|
.get(),
|
||||||
percentage.get(),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
|
@ -80,7 +80,12 @@ pub fn TimePicker(#[prop(optional, into)] value: RwSignal<Option<NaiveTime>>) ->
|
||||||
</Input>
|
</Input>
|
||||||
</div>
|
</div>
|
||||||
<Follower slot show=is_show_panel placement=FollowerPlacement::BottomStart>
|
<Follower slot show=is_show_panel placement=FollowerPlacement::BottomStart>
|
||||||
<Panel selected_time=panel_selected_time close_panel time_picker_ref comp_ref=panel_ref/>
|
<Panel
|
||||||
|
selected_time=panel_selected_time
|
||||||
|
close_panel
|
||||||
|
time_picker_ref
|
||||||
|
comp_ref=panel_ref
|
||||||
|
/>
|
||||||
</Follower>
|
</Follower>
|
||||||
</Binder>
|
</Binder>
|
||||||
}
|
}
|
||||||
|
@ -116,12 +121,12 @@ fn Panel(
|
||||||
});
|
});
|
||||||
css_vars
|
css_vars
|
||||||
});
|
});
|
||||||
let now = move |_| {
|
let now = Callback::new(move |_| {
|
||||||
close_panel.call(Some(now_time()));
|
close_panel.call(Some(now_time()));
|
||||||
};
|
});
|
||||||
let ok = move |_| {
|
let ok = Callback::new(move |_| {
|
||||||
close_panel.call(selected_time.get_untracked());
|
close_panel.call(selected_time.get_untracked());
|
||||||
};
|
});
|
||||||
|
|
||||||
let panel_ref = create_node_ref::<html::Div>();
|
let panel_ref = create_node_ref::<html::Div>();
|
||||||
#[cfg(any(feature = "csr", feature = "hydrate"))]
|
#[cfg(any(feature = "csr", feature = "hydrate"))]
|
||||||
|
@ -170,7 +175,6 @@ fn Panel(
|
||||||
<div class="thaw-time-picker-panel__time-hour" ref=hour_ref>
|
<div class="thaw-time-picker-panel__time-hour" ref=hour_ref>
|
||||||
|
|
||||||
{(0..24)
|
{(0..24)
|
||||||
.into_iter()
|
|
||||||
.map(|hour| {
|
.map(|hour| {
|
||||||
let comp_ref = ComponentRef::<PanelTimeItemRef>::default();
|
let comp_ref = ComponentRef::<PanelTimeItemRef>::default();
|
||||||
let on_click = move |_| {
|
let on_click = move |_| {
|
||||||
|
@ -191,12 +195,12 @@ fn Panel(
|
||||||
<PanelTimeItem value=hour on:click=on_click is_selected comp_ref/>
|
<PanelTimeItem value=hour on:click=on_click is_selected comp_ref/>
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect_view()} <div class="thaw-time-picker-panel__time-padding"></div>
|
.collect_view()}
|
||||||
|
<div class="thaw-time-picker-panel__time-padding"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="thaw-time-picker-panel__time-minute" ref=minute_ref>
|
<div class="thaw-time-picker-panel__time-minute" ref=minute_ref>
|
||||||
|
|
||||||
{(0..60)
|
{(0..60)
|
||||||
.into_iter()
|
|
||||||
.map(|minute| {
|
.map(|minute| {
|
||||||
let comp_ref = ComponentRef::<PanelTimeItemRef>::default();
|
let comp_ref = ComponentRef::<PanelTimeItemRef>::default();
|
||||||
let on_click = move |_| {
|
let on_click = move |_| {
|
||||||
|
@ -217,12 +221,12 @@ fn Panel(
|
||||||
<PanelTimeItem value=minute on:click=on_click is_selected comp_ref/>
|
<PanelTimeItem value=minute on:click=on_click is_selected comp_ref/>
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect_view()} <div class="thaw-time-picker-panel__time-padding"></div>
|
.collect_view()}
|
||||||
|
<div class="thaw-time-picker-panel__time-padding"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="thaw-time-picker-panel__time-second" ref=second_ref>
|
<div class="thaw-time-picker-panel__time-second" ref=second_ref>
|
||||||
|
|
||||||
{(0..60)
|
{(0..60)
|
||||||
.into_iter()
|
|
||||||
.map(|second| {
|
.map(|second| {
|
||||||
let comp_ref = ComponentRef::<PanelTimeItemRef>::default();
|
let comp_ref = ComponentRef::<PanelTimeItemRef>::default();
|
||||||
let on_click = move |_| {
|
let on_click = move |_| {
|
||||||
|
@ -243,7 +247,8 @@ fn Panel(
|
||||||
<PanelTimeItem value=second on:click=on_click is_selected comp_ref/>
|
<PanelTimeItem value=second on:click=on_click is_selected comp_ref/>
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect_view()} <div class="thaw-time-picker-panel__time-padding"></div>
|
.collect_view()}
|
||||||
|
<div class="thaw-time-picker-panel__time-padding"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="thaw-time-picker-panel__footer">
|
<div class="thaw-time-picker-panel__footer">
|
||||||
|
|
|
@ -17,12 +17,12 @@ pub fn Text(#[prop(optional)] code: bool, children: Children) -> impl IntoView {
|
||||||
});
|
});
|
||||||
|
|
||||||
if code {
|
if code {
|
||||||
return view! {
|
view! {
|
||||||
<code class="thaw-text thaw-text--code" style=move || css_vars.get()>
|
<code class="thaw-text thaw-text--code" style=move || css_vars.get()>
|
||||||
{children()}
|
{children()}
|
||||||
</code>
|
</code>
|
||||||
}
|
}
|
||||||
.into_any();
|
.into_any()
|
||||||
} else {
|
} else {
|
||||||
view! { <span class="thaw-text">{children()}</span> }.into_any()
|
view! { <span class="thaw-text">{children()}</span> }.into_any()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue