Sha256: 43261b5e3db068ed35936d49dc9895152c66b57a2b3fcd08665895d71ba7b5f4

Contents?: true

Size: 734 Bytes

Versions: 3

Compression:

Stored size: 734 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
    # @example auto|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

3 entries across 3 versions & 1 rubygems

Version Path
primer_view_components-0.0.21 app/components/primer/heading_component.rb
primer_view_components-0.0.20 app/components/primer/heading_component.rb
primer_view_components-0.0.19 app/components/primer/heading_component.rb