feat: make `Transition` `set_pending` use `#[prop(into)]` (#1746)

This commit is contained in:
Greg Johnston 2023-09-18 22:46:03 -04:00 committed by GitHub
parent 661a038780
commit 1bd47f34e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View File

@ -80,7 +80,7 @@ pub fn Stories() -> impl IntoView {
<div>
<Transition
fallback=move || view! { <p>"Loading..."</p> }
set_pending=set_pending.into()
set_pending
>
{move || match stories.get() {
None => None,

View File

@ -70,7 +70,7 @@ pub fn Stories() -> impl IntoView {
>
<a href=move || format!("/{}?page={}", story_type(), page() + 1)
aria-label="Next Page"
>
>=
"more >"
</a>
</span>
@ -79,7 +79,7 @@ pub fn Stories() -> impl IntoView {
<div>
<Transition
fallback=move || view! { <p>"Loading..."</p> }
set_pending=set_pending.into()
set_pending
>
{move || match stories.get() {
None => None,

View File

@ -91,7 +91,7 @@ pub fn Stories() -> impl IntoView {
<div>
<Transition
fallback=|| ()
set_pending=set_pending.into()
set_pending
>
{move || stories.get().map(|story| story.map(|stories| view! {
<ul>

View File

@ -39,7 +39,7 @@ use std::{
/// <div>
/// <Transition
/// fallback=move || view! { <p>"Loading..."</p>}
/// set_pending=set_pending.into()
/// set_pending
/// >
/// {move || {
/// cats.read().map(|data| match data {
@ -72,7 +72,7 @@ pub fn Transition<F, E>(
/// A function that will be called when the component transitions into or out of
/// the `pending` state, with its argument indicating whether it is pending (`true`)
/// or not pending (`false`).
#[prop(optional)]
#[prop(optional, into)]
set_pending: Option<SignalSetter<bool>>,
/// Will be displayed once all resources have resolved.
children: Box<dyn Fn() -> Fragment>,