Skip to content
Snippets Groups Projects
Unverified Commit 137c421a authored by John's avatar John Committed by GitHub
Browse files

Merge pull request #82 from StarArawn/forward-attrs

Forwarded attributes on functional widgets
parents c2494886 1b365205
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ use kayak_render_macros::{rsx, use_state, widget, WidgetProps};
#[derive(WidgetProps, Clone, Default, Debug, PartialEq)]
#[allow(dead_code)]
struct TestProps {
/// A test prop
foo: u32,
#[prop_field(Styles)]
styles: Option<Style>,
......@@ -15,6 +16,7 @@ struct TestProps {
}
#[widget]
/// A test widget
fn Test(props: TestProps) {
let _ = use_state!(props.foo);
let children = props.get_children();
......
......@@ -28,12 +28,14 @@ pub fn create_function_widget(f: syn::ItemFn, _widget_arguments: WidgetArguments
return TokenStream::new();
};
let attrs = f.attrs;
let block = f.block;
let vis = f.vis;
let kayak_core = get_core_crate();
TokenStream::from(quote! {
#(#attrs)*
#[derive(Default, Debug, PartialEq, Clone)]
#vis struct #struct_name #impl_generics {
pub id: #kayak_core::Index,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment