Sha256: 005c4882c19ec0ca9faae2d58a79b7bd230d715ddad1b25e422398dc00d2bb7f

Contents?: true

Size: 755 Bytes

Versions: 6

Compression:

Stored size: 755 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
    view_helper :heading

    # @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

6 entries across 6 versions & 1 rubygems

Version Path
primer_view_components-0.0.27 app/components/primer/heading_component.rb
primer_view_components-0.0.26 app/components/primer/heading_component.rb
primer_view_components-0.0.25 app/components/primer/heading_component.rb
primer_view_components-0.0.24 app/components/primer/heading_component.rb
primer_view_components-0.0.23 app/components/primer/heading_component.rb
primer_view_components-0.0.22 app/components/primer/heading_component.rb