Sha256: b782566c809f2f5c6e414cabcbcd0730d00e7272cd6798c9dbcb4e8d699e8708
Contents?: true
Size: 901 Bytes
Versions: 1
Compression:
Stored size: 901 Bytes
Contents
module Lookbook class Nav::Item::Component < Lookbook::BaseComponent delegate :label, :depth, 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 - 1) * 12) + 24 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lookbook-1.4.1 | app/components/lookbook/nav/item/component.rb |