Sha256: 19bb7bdd62977bf7c7a98e4eb3bfeb7c739fe0d6ac905944dc0d12828130a104

Contents?: true

Size: 787 Bytes

Versions: 4

Compression:

Stored size: 787 Bytes

Contents

# frozen_string_literal: true

module Primer
  # `Text` is a wrapper component that will apply typography styles to the text inside.
  class TextComponent < Primer::Component
    status :beta

    DEFAULT_TAG = :span

    # @example Default
    #   <%= render(Primer::TextComponent.new(tag: :p, font_weight: :bold)) { "Bold Text" } %>
    #   <%= render(Primer::TextComponent.new(tag: :p, color: :text_danger)) { "Danger Text" } %>
    #
    # @param tag [Symbol]
    # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
    def initialize(tag: DEFAULT_TAG, **system_arguments)
      @system_arguments = system_arguments
      @system_arguments[:tag] = tag
    end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
primer_view_components-0.0.43 app/components/primer/text_component.rb
primer_view_components-0.0.42 app/components/primer/text_component.rb
primer_view_components-0.0.41 app/components/primer/text_component.rb
primer_view_components-0.0.40 app/components/primer/text_component.rb