Sha256: cac0cf3f3b2e1c9b113d7e1267c0ef1880b2cb77d8799109c2a9d45dfaca60ee

Contents?: true

Size: 1.18 KB

Versions: 111

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

module Primer
  module Beta
    class NavList
      # The heading placed above a `NavList`'s items.
      #
      # See <%= link_to_component(Primer::Beta::NavList) %> for usage examples.
      class Heading < Primer::Component
        attr_reader :title, :id, :heading_level, :system_arguments

        # @param title [String] The text content of the heading.
        # @param id [String] The value of the ID HTML attribute. Auto-generated by default.
        # @param heading_level [Integer] The heading level, i.e. 2 for an `<h2>`, 3 for an `<h3>`, etc.
        # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
        def initialize(title:, id: self.class.generate_id, heading_level: 2, **system_arguments)
          @title = title
          @id = id
          @heading_level = heading_level
          @system_arguments = system_arguments
        end

        def call
          render(
            Primer::BaseComponent.new(
              tag: :"h#{heading_level}",
              id: id,
              classes: "ActionListHeader",
              **system_arguments
            ).with_content(title)
          )
        end
      end
    end
  end
end

Version data entries

111 entries across 111 versions & 2 rubygems

Version Path
primer_view_components-0.36.5 app/components/primer/beta/nav_list/heading.rb
openproject-primer_view_components-0.52.2 app/components/primer/beta/nav_list/heading.rb
primer_view_components-0.36.4 app/components/primer/beta/nav_list/heading.rb
openproject-primer_view_components-0.52.1 app/components/primer/beta/nav_list/heading.rb
openproject-primer_view_components-0.52.0 app/components/primer/beta/nav_list/heading.rb
primer_view_components-0.36.3 app/components/primer/beta/nav_list/heading.rb
openproject-primer_view_components-0.51.0 app/components/primer/beta/nav_list/heading.rb
primer_view_components-0.36.2 app/components/primer/beta/nav_list/heading.rb
openproject-primer_view_components-0.50.1 app/components/primer/beta/nav_list/heading.rb
openproject-primer_view_components-0.50.0 app/components/primer/beta/nav_list/heading.rb
primer_view_components-0.36.1 app/components/primer/beta/nav_list/heading.rb
primer_view_components-0.36.0 app/components/primer/beta/nav_list/heading.rb
openproject-primer_view_components-0.49.2 app/components/primer/beta/nav_list/heading.rb
primer_view_components-0.35.2 app/components/primer/beta/nav_list/heading.rb
openproject-primer_view_components-0.49.1 app/components/primer/beta/nav_list/heading.rb
openproject-primer_view_components-0.49.0 app/components/primer/beta/nav_list/heading.rb
primer_view_components-0.35.1 app/components/primer/beta/nav_list/heading.rb
primer_view_components-0.35.0 app/components/primer/beta/nav_list/heading.rb
openproject-primer_view_components-0.48.2 app/components/primer/beta/nav_list/heading.rb
openproject-primer_view_components-0.48.1 app/components/primer/beta/nav_list/heading.rb