Sha256: 02e4c6665f45713aafda1baf32dc6d93c24dd828b999e69b3afc4ee93fbe9b50
Contents?: true
Size: 899 Bytes
Versions: 28
Compression:
Stored size: 899 Bytes
Contents
module Lookbook class Nav::Item::Component < Lookbook::BaseComponent delegate :label, :depth, :priority, to: :node attr_reader :node, :nav_id def initialize(node, nav_id:, **html_attrs) @node = node @nav_id = nav_id super(**html_attrs) end def id "#{nav_id}-#{node.id}" end def left_pad depth * 12 end def children @children ||= node.sort.map { |node| render_item(node) } end def nav_icon :folder end def children? children.any? end def render_item(node) item_class = (node.type == :directory) ? Nav::Directory::Component : Nav::Entity::Component lookbook_render item_class.new node, nav_id: nav_id end protected def alpine_data alpine_encode({id: node.id, matchers: []}) end def alpine_component "navItemComponent" end end end
Version data entries
28 entries across 28 versions & 1 rubygems