🚧 Pack and Veck for arrays of components

This commit is contained in:
Manuel Cillero 2023-08-15 00:53:14 +02:00
parent 3d86115f97
commit 6197052ae7
22 changed files with 229 additions and 114 deletions

View file

@ -4,8 +4,8 @@ use crate::component::MegaMenu;
new_handle!(COMPONENT_MEGAITEM);
type Label = OneComponent<L10n>;
type Content = OneComponent<Html>;
type Label = ComponentOne<L10n>;
type Content = ComponentOne<Html>;
#[derive(Default)]
pub enum MegaItemType {

View file

@ -26,7 +26,7 @@ pub struct MegaMenu {
weight : Weight,
renderable: Renderable,
id : IdentifierValue,
items : PackComponents,
items : VeckComponents<MegaItem>,
theme : MegaMenuTheme,
}
@ -153,12 +153,13 @@ impl MegaMenu {
}
pub fn with_item(mut self, item: MegaItem) -> Self {
self.items.alter(PackOp::Add, ComponentArc::new(item));
self.items.alter(VeckOp::Add(ComponentOne::with(item)));
self
}
pub fn alter_items(&mut self, op: PackOp, item: MegaItem) -> &mut Self {
self.items.alter(op, ComponentArc::new(item));
#[fn_builder]
pub fn alter_items(&mut self, op: VeckOp<MegaItem>) -> &mut Self {
self.items.alter(op);
self
}
@ -170,7 +171,7 @@ impl MegaMenu {
// MegaMenu GETTERS.
pub fn items(&self) -> &PackComponents {
pub fn items(&self) -> &VeckComponents<MegaItem> {
&self.items
}