Sha256: 34845690995ef94c3a3c54053ded25229855f8384ed1acd99be177bd365b8f2f
Contents?: true
Size: 1.41 KB
Versions: 17
Compression:
Stored size: 1.41 KB
Contents
module Coco module App module Blocks module SidebarNav class Navbar < Coco::Component tag_name :nav component_name :app_sidebar_nav renders_many :actions, ->(label, href, icon:, **kwargs) do actions_data << {label: label, href: href, icon: icon, **kwargs} end renders_many :items, types: { link: ->(label, href, show_on_mobile: true, **kwargs, &block) do nav_item(mobile: show_on_mobile) do render Coco::App::Blocks::SidebarNav::Item.new(label: label, href: href, **kwargs), &block end end, menu: ->(label, show_on_mobile: true, **kwargs, &block) do nav_item(mobile: show_on_mobile) do render Coco::App::Blocks::SidebarNav::Item.new(label: label, **kwargs) do |item| item.with_menu(&block) end end end } attr_reader :actions_data def initialize(**) @actions_data = [] @menus_data = {} end def nav_item(mobile: true, &block) tag.div(class: "nav-item", data: {show_on_mobile: mobile.to_s}, &block) end def with_link(...) with_item_link(...) end def with_menu(...) with_item_menu(...) end end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems