Sha256: fcdcb861c03615dcfec7d18a1ed0d368a0848d0280e72a8a36dd58f7d00e2f84

Contents?: true

Size: 860 Bytes

Versions: 1

Compression:

Stored size: 860 Bytes

Contents

# frozen_string_literal: true

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

      DEFAULT_TAG = :span

      # @example Default
      #   <%= render(Primer::Beta::Text.new(tag: :p, font_weight: :bold)) { "Bold Text" } %>
      #   <%= render(Primer::Beta::Text.new(tag: :p, color: :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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
primer_view_components-0.0.115 app/components/primer/beta/text.rb