Sha256: eb3014314b8ac0150de7ce4bed1b42c11dc4ebfb9d6c6e16a1730895fcb2fb28

Contents?: true

Size: 622 Bytes

Versions: 38

Compression:

Stored size: 622 Bytes

Contents

module Lookbook
  class Nav::Component < Lookbook::BaseComponent
    renders_one :filter, Lookbook::Filter::Component
    renders_one :toolbar, Lookbook::Toolbar::Component

    attr_reader :id, :tree

    def initialize(tree:, id: nil, **attrs)
      @id = id
      @tree = tree
      super(**attrs, id: id)
    end

    def items
      @items ||= tree.map do |node|
        item_class = (node.type == :directory) ? Nav::Directory::Component : Nav::Entity::Component
        lookbook_render item_class.new node, nav_id: id
      end
    end

    protected

    def alpine_component
      "navComponent"
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
lookbook-2.3.4 app/components/lookbook/nav/component.rb
lookbook-2.3.3 app/components/lookbook/nav/component.rb
lookbook-2.3.2 app/components/lookbook/nav/component.rb
lookbook-2.3.0 app/components/lookbook/nav/component.rb
lookbook-2.2.2 app/components/lookbook/nav/component.rb
lookbook-2.2.1 app/components/lookbook/nav/component.rb
lookbook-2.2.0 app/components/lookbook/nav/component.rb
lookbook-2.1.1 app/components/lookbook/nav/component.rb
lookbook-2.1.0 app/components/lookbook/nav/component.rb
lookbook-2.0.5 app/components/lookbook/nav/component.rb
lookbook-2.0.4 app/components/lookbook/nav/component.rb
lookbook-2.0.3 app/components/lookbook/nav/component.rb
lookbook-2.0.2 app/components/lookbook/nav/component.rb
lookbook-2.0.1 app/components/lookbook/nav/component.rb
lookbook-2.0.0 app/components/lookbook/nav/component.rb
lookbook-2.0.0.rc.3 app/components/lookbook/nav/component.rb
lookbook-1.5.5 app/components/lookbook/nav/component.rb
lookbook-1.5.4 app/components/lookbook/nav/component.rb
lookbook-2.0.0.rc.2 app/components/lookbook/nav/component.rb
lookbook-2.0.0.rc.1 app/components/lookbook/nav/component.rb