Sha256: 5020946e336c0459628f9250ab61f8a864234c6bc4afff4c261c43d7647b90ef

Contents?: true

Size: 1.15 KB

Versions: 27

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module Primer
  module Alpha
    class ActionList
      # Section heading rendered above the section contents.
      class Divider < Primer::Component
        DEFAULT_SCHEME = :subtle
        SCHEME_MAPPINGS = {
          DEFAULT_SCHEME => nil,
          :filled => "ActionList-sectionDivider--filled"
        }.freeze
        SCHEME_OPTIONS = SCHEME_MAPPINGS.keys.freeze

        # @param scheme [Symbol] Display a background color if scheme is `filled`.
        # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
        def initialize(scheme: DEFAULT_SCHEME, **system_arguments)
          @system_arguments = system_arguments
          @system_arguments[:tag] = :li
          @system_arguments[:role] = :separator
          @system_arguments[:'aria-hidden'] = true
          @scheme = fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)
          @system_arguments[:classes] = class_names(
            "ActionList-sectionDivider",
            SCHEME_MAPPINGS[@scheme]
          )
        end

        def call
          render(Primer::BaseComponent.new(**@system_arguments)) { "" }
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
primer_view_components-0.1.0 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.123 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.122 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.121 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.120 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.119 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.118 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.117 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.116 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.114 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.113 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.112 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.111 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.110 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.109 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.108 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.107 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.106 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.105 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.0.104 app/components/primer/alpha/action_list/divider.rb