Sha256: 9f21e0dbb675c3b32e409425acace6eb04b74faab606dad1ade4a5fbd256ca11

Contents?: true

Size: 577 Bytes

Versions: 2

Compression:

Stored size: 577 Bytes

Contents

# frozen_string_literal: true

# Renders the sidebar
class SolidusAdmin::Sidebar::Component < SolidusAdmin::BaseComponent
  def initialize(
    store:,
    logo_path: SolidusAdmin::Config.logo_path,
    items: SolidusAdmin::Config.menu_items
  )
    @logo_path = logo_path
    @items = items.map do |attrs|
      children = attrs[:children].to_a.map { SolidusAdmin::MainNavItem.new(**_1, top_level: false) }
      SolidusAdmin::MainNavItem.new(**attrs, children: children, top_level: true)
    end
    @store = store
  end

  def items
    @items.sort_by(&:position)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solidus_admin-0.0.2 app/components/solidus_admin/sidebar/component.rb
solidus_admin-0.0.1 app/components/solidus_admin/sidebar/component.rb