Sha256: 5a09600338942e5dc87bb2aba40a76b51e57218fdcd18782687b71482521927f

Contents?: true

Size: 1.21 KB

Versions: 7

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module Primer
  # @label Dropdown
  class DropdownPreview < ViewComponent::Preview
    # @label Default Options
    #
    # @param with_caret [Boolean] toggle
    # @param overlay [Symbol] select [none, default, dark]
    def default(overlay: :default, with_caret: false)
      render(Primer::Dropdown.new(overlay: overlay, with_caret: with_caret)) do |c|
        c.with_button { "Dropdown" }

        c.with_menu(header: "Header") do |m|
          m.with_item { "Item 1" }
          m.with_item { "Item 2" }
          m.with_item(divider: true)
          m.with_item { "Item 3" }
          m.with_item { "Item 4" }
        end
      end
    end

    # @label Menu Options
    #
    # @param as [Symbol] select [list, default]
    # @param direction [Symbol] select [se, sw, w, e, ne, s]
    # @param scheme [Symbol] select [default, dark]
    def menu(as: :default, direction: :se, scheme: :default)
      render(Primer::Dropdown::Menu.new(as: as, direction: direction, scheme: scheme, header: "Header")) do |m|
        m.with_item { "Item 1" }
        m.with_item { "Item 2" }
        m.with_item(divider: true)
        m.with_item { "Item 3" }
        m.with_item { "Item 4" }
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
primer_view_components-0.0.104 previews/primer/dropdown_preview.rb
primer_view_components-0.0.103 previews/primer/dropdown_preview.rb
primer_view_components-0.0.102 previews/primer/dropdown_preview.rb
primer_view_components-0.0.101 previews/primer/dropdown_preview.rb
primer_view_components-0.0.100 previews/primer/dropdown_preview.rb
primer_view_components-0.0.99 previews/primer/dropdown_preview.rb
primer_view_components-0.0.98 previews/primer/dropdown_preview.rb