Sha256: 6d4e019ef87e83ab6346e3b9028959e004959273600eea3f6252ba9d3641c541

Contents?: true

Size: 747 Bytes

Versions: 10

Compression:

Stored size: 747 Bytes

Contents

# frozen_string_literal: true

module Primer
  # Use the Heading component to wrap a component that will create a heading element
  class HeadingComponent < Primer::Component
    status :beta

    # @example Default
    #   <%= render(Primer::HeadingComponent.new) { "H1 Text" } %>
    #   <%= render(Primer::HeadingComponent.new(tag: :h2)) { "H2 Text" } %>
    #   <%= render(Primer::HeadingComponent.new(tag: :h3)) { "H3 Text" } %>
    #
    # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
    def initialize(**system_arguments)
      @system_arguments = system_arguments
      @system_arguments[:tag] ||= :h1
    end

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
primer_view_components-0.0.37 app/components/primer/heading_component.rb
primer_view_components-0.0.36 app/components/primer/heading_component.rb
primer_view_components-0.0.35 app/components/primer/heading_component.rb
primer_view_components-0.0.34 app/components/primer/heading_component.rb
primer_view_components-0.0.33 app/components/primer/heading_component.rb
primer_view_components-0.0.32 app/components/primer/heading_component.rb
primer_view_components-0.0.31 app/components/primer/heading_component.rb
primer_view_components-0.0.30 app/components/primer/heading_component.rb
primer_view_components-0.0.29 app/components/primer/heading_component.rb
primer_view_components-0.0.28 app/components/primer/heading_component.rb