🏗️ Use actions to decide component rendering
This commit is contained in:
parent
45cb063e52
commit
7d4cf642ff
27 changed files with 125 additions and 304 deletions
|
|
@ -5,9 +5,8 @@ use super::Item;
|
|||
#[rustfmt::skip]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Menu {
|
||||
id : OptionId,
|
||||
renderable: Renderable,
|
||||
items : MixedComponents,
|
||||
id : OptionId,
|
||||
items: MixedComponents,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Menu {
|
||||
|
|
@ -19,10 +18,6 @@ impl ComponentTrait for Menu {
|
|||
self.id.get()
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
cx.set_param::<bool>(PARAM_BASE_INCLUDE_MENU_ASSETS, true);
|
||||
cx.set_param::<bool>(PARAM_BASE_INCLUDE_ICONS, true);
|
||||
|
|
@ -69,12 +64,6 @@ impl Menu {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_items(&mut self, op: TypedOp<Item>) -> &mut Self {
|
||||
self.items.alter_typed(op);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue