Skip to content
Snippets Groups Projects
Unverified Commit d1ed7b69 authored by Johan Klokkhammer Helsing's avatar Johan Klokkhammer Helsing Committed by GitHub
Browse files

docs: Fix build errors in example chapter 3

parent ea637ae3
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,7 @@ I think it's best if we showcase a simple example: ...@@ -12,7 +12,7 @@ I think it's best if we showcase a simple example:
// This is because we need to diff the previous values of these. // This is because we need to diff the previous values of these.
// Default is used to make creating widgets a little easier. // Default is used to make creating widgets a little easier.
// And component is required since this is a bevy component! // And component is required since this is a bevy component!
[#derive(Component, Clone, PartialEq, Default)] #[derive(Component, Clone, PartialEq, Default)]
pub struct MyButtonProps { pub struct MyButtonProps {
} }
...@@ -76,13 +76,15 @@ pub fn my_button_render( ...@@ -76,13 +76,15 @@ pub fn my_button_render(
..Default::default() ..Default::default()
}; };
let parent_id = Some(entity);
rsx! { rsx! {
<BackgroundBundle <BackgroundBundle
styles={background_styles} styles={background_styles}
// We pass the children to the background bundle! // We pass the children to the background bundle!
children={children.clone()} children={children.clone()}
/> />
} };
} }
// The boolean returned here tells kayak UI to update the tree. You can avoid tree updates by // The boolean returned here tells kayak UI to update the tree. You can avoid tree updates by
...@@ -99,10 +101,10 @@ fn startup(...) { ...@@ -99,10 +101,10 @@ fn startup(...) {
// We need to register the prop and state types. // We need to register the prop and state types.
// State is empty so you can use the `EmptyState` component! // State is empty so you can use the `EmptyState` component!
context.add_widget_data::<MyButtonProps, EmptyState>(); widget_context.add_widget_data::<MyButtonProps, EmptyState>();
// Next we need to add the systems // Next we need to add the systems
context.add_widget_system( widget_context.add_widget_system(
// We are registering these systems with a specific WidgetName. // We are registering these systems with a specific WidgetName.
MyButtonProps::default().get_name(), MyButtonProps::default().get_name(),
// widget_update auto diffs props and state. // widget_update auto diffs props and state.
......
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