Sha256: 3fe9d429fbdd2335de739355b0911c30c364bd81a0c4ed8b2fbadf9378034cee

Contents?: true

Size: 823 Bytes

Versions: 2

Compression:

Stored size: 823 Bytes

Contents

# frozen_string_literal: true

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

      DEFAULT_TAG = :span

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yattho_view_components-0.1.1 app/components/yattho/beta/text.rb
yattho_view_components-0.0.1 app/components/yattho/beta/text.rb