Sha256: 9243cc1e13495fa9f66d21d238f205ab2e18be0c9a3ed156ee535b556edf8383

Contents?: true

Size: 1.19 KB

Versions: 125

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

module Primer
  module Alpha
    class ActionList
      # Separator with optional text rendered above groups or between individual items.
      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] = :presentation
          @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)) { content }
        end
      end
    end
  end
end

Version data entries

125 entries across 125 versions & 2 rubygems

Version Path
openproject-primer_view_components-0.52.0 app/components/primer/alpha/action_list/divider.rb
openproject-primer_view_components-0.51.0 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.36.2 app/components/primer/alpha/action_list/divider.rb
openproject-primer_view_components-0.50.1 app/components/primer/alpha/action_list/divider.rb
openproject-primer_view_components-0.50.0 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.36.1 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.36.0 app/components/primer/alpha/action_list/divider.rb
openproject-primer_view_components-0.49.2 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.35.2 app/components/primer/alpha/action_list/divider.rb
openproject-primer_view_components-0.49.1 app/components/primer/alpha/action_list/divider.rb
openproject-primer_view_components-0.49.0 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.35.1 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.35.0 app/components/primer/alpha/action_list/divider.rb
openproject-primer_view_components-0.48.2 app/components/primer/alpha/action_list/divider.rb
openproject-primer_view_components-0.48.1 app/components/primer/alpha/action_list/divider.rb
openproject-primer_view_components-0.48.0 app/components/primer/alpha/action_list/divider.rb
openproject-primer_view_components-0.47.1 app/components/primer/alpha/action_list/divider.rb
openproject-primer_view_components-0.47.0 app/components/primer/alpha/action_list/divider.rb
primer_view_components-0.34.0 app/components/primer/alpha/action_list/divider.rb
openproject-primer_view_components-0.46.1 app/components/primer/alpha/action_list/divider.rb