Sha256: 788818ae62abaab80e86712fb71be287de3bc2620d981b06949d3fbbc1054333
Contents?: true
Size: 887 Bytes
Versions: 300
Compression:
Stored size: 887 Bytes
Contents
# frozen_string_literal: true module Ariadne # `Text` is a wrapper component that will apply typography styles to the text inside. class Text < Ariadne::Component DEFAULT_TAG = :span # @example Default # <%= render(Ariadne::Text.new(tag: :p, attributes: { font_weight: :bold })) { "Bold Text" } %> # <%= render(Ariadne::Text.new(tag: :p, attributes: { color: :danger })) { "Danger Text" } %> # # @param tag [Symbol, String] The rendered tag name # @param classes [String] <%= link_to_classes_docs %> # @param attributes [Hash] <%= link_to_attributes_docs %> def initialize(tag: DEFAULT_TAG, classes: "", attributes: {}) @tag = tag @classes = classes @attributes = attributes end def call render(Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes)) { content } end end end
Version data entries
300 entries across 300 versions & 1 rubygems