Class: Polaris::TextStyleComponent
- Defined in:
- app/components/polaris/text_style_component.rb
Constant Summary collapse
- VARIATION_DEFAULT =
:default- VARIATION_MAPPINGS =
{ VARIATION_DEFAULT => "", :positive => "Polaris-TextStyle--variationPositive", :negative => "Polaris-TextStyle--variationNegative", :strong => "Polaris-TextStyle--variationStrong", :subdued => "Polaris-TextStyle--variationSubdued", :code => "Polaris-TextStyle--variationCode" }
- VARIATION_OPTIONS =
VARIATION_MAPPINGS.keys
- SIZE_DEFAULT =
:default- SIZE_MAPPINGS =
{ SIZE_DEFAULT => "", :small => "Polaris-TextStyle--sizeSmall" }
- SIZE_OPTIONS =
SIZE_MAPPINGS.keys
Constants included from ViewHelper
ViewHelper::POLARIS_HELPERS, ViewHelper::POLARIS_TEXT_STYLES
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(variation: VARIATION_DEFAULT, size: SIZE_DEFAULT, **system_arguments) ⇒ TextStyleComponent
constructor
A new instance of TextStyleComponent.
Methods included from ViewHelper
#polaris_body_styles, #polaris_icon_source, #polaris_inversed_colors
Methods included from OptionHelper
#append_option, #prepend_option
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean
Methods included from ClassNameHelper
Constructor Details
#initialize(variation: VARIATION_DEFAULT, size: SIZE_DEFAULT, **system_arguments) ⇒ TextStyleComponent
Returns a new instance of TextStyleComponent.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/components/polaris/text_style_component.rb', line 23 def initialize( variation: VARIATION_DEFAULT, size: SIZE_DEFAULT, **system_arguments ) @system_arguments = system_arguments @system_arguments[:tag] = "span" @system_arguments[:classes] = class_names( @system_arguments[:classes], VARIATION_MAPPINGS[fetch_or_fallback(VARIATION_OPTIONS, variation, VARIATION_DEFAULT)], SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, SIZE_DEFAULT)] ) end |
Instance Method Details
#call ⇒ Object
37 38 39 |
# File 'app/components/polaris/text_style_component.rb', line 37 def call render(Polaris::BaseComponent.new(**@system_arguments)) { content } end |