Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Style into AttributeValue #19

Open
israelsilvabarbara opened this issue Jan 8, 2025 · 0 comments
Open

Convert Style into AttributeValue #19

israelsilvabarbara opened this issue Jan 8, 2025 · 0 comments

Comments

@israelsilvabarbara
Copy link

Case:

use leptos_node_ref::AnyNodeRef;
use radix_leptos_label::Label as LabelPrimitive;
use tailwind_fuse::*;
use leptos_style::Style;

#[component]
pub fn Label( 
   #[prop(into, optional)] style: Signal<Style>,
) -> impl IntoView {
    view! {
        <LabelPrimitive
            attr:style=style.get()
        />
    }
}

gives me the error:

error[E0277]: the trait bound `leptos_style::Style: IntoAttributeValue` is not satisfied
  --> packages/leptos/label/src/default.rs:21:24
   |
19 | /     view! {
20 | |         <LabelPrimitive
21 | |             attr:style=style.get()
   | |                        ^^^^^^^^^^^ the trait `FnMut()` is not implemented for `leptos_style::Style`
...  |
25 | |         </LabelPrimitive>
26 | |     }
   | |_____- required by a bound introduced by this call
   |
   = note: required for `leptos_style::Style` to implement `ReactiveFunction`
   = note: required for `leptos_style::Style` to implement `AttributeValue`
   = note: required for `leptos_style::Style` to implement `IntoAttributeValue`

There is an option to use .to_string() which solves the problem but add unnecessary verbose into the code.

I have set up a small PR implementing IntoAttributeValue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant