module Coco module App module Blocks class SidebarNav < Coco::Component renders_many :actions, ->(label, href, icon:, **kwargs) do @actions_data << {label: label, href: href, icon: icon, **kwargs} end renders_many :items, ->(label, href, show_on_mobile: true, **kwargs, &block) do tag.div class: ["nav-item", ("mobile-nav-item" if show_on_mobile)] do render Coco::App::Blocks::SidebarNavItem.new( label: label, href: href, active: helpers.current_page?(href), **kwargs ), &block end end attr_reader :actions_data def initialize(**) @actions_data = [] end end end end end