Class: Polaris::StackComponent
- Defined in:
- app/components/polaris/stack_component.rb
Constant Summary collapse
- ALIGNMENT_DEFAULT =
:default
- ALIGNMENT_MAPPINGS =
{ ALIGNMENT_DEFAULT => "", :leading => "Polaris-LegacyStack--alignmentLeading", :trailing => "Polaris-LegacyStack--alignmentTrailing", :center => "Polaris-LegacyStack--alignmentCenter", :fill => "Polaris-LegacyStack--alignmentFill", :baseline => "Polaris-LegacyStack--alignmentBaseline" }
- ALIGNMENT_OPTIONS =
ALIGNMENT_MAPPINGS.keys
- DISTRIBUTION_DEFAULT =
:default
- DISTRIBUTION_MAPPINGS =
{ DISTRIBUTION_DEFAULT => "", :equal_spacing => "Polaris-LegacyStack--distributionEqualSpacing", :leading => "Polaris-LegacyStack--distributionLeading", :trailing => "Polaris-LegacyStack--distributionTrailing", :center => "Polaris-LegacyStack--distributionCenter", :fill => "Polaris-LegacyStack--distributionFill", :fill_evenly => "Polaris-LegacyStack--distributionFillEvenly" }
- DISTRIBUTION_OPTIONS =
DISTRIBUTION_MAPPINGS.keys
- SPACING_DEFAULT =
:default
- SPACING_MAPPINGS =
{ SPACING_DEFAULT => "", :extra_tight => "Polaris-LegacyStack--spacingExtraTight", :tight => "Polaris-LegacyStack--spacingTight", :base_tight => "Polaris-LegacyStack--spacingBaseTight", :loose => "Polaris-LegacyStack--spacingLoose", :extra_loose => "Polaris-LegacyStack--spacingExtraLoose", :none => "Polaris-LegacyStack--spacingNone" }
- SPACING_OPTIONS =
SPACING_MAPPINGS.keys
Constants included from ViewHelper
ViewHelper::POLARIS_HELPERS, ViewHelper::POLARIS_TEXT_STYLES
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Instance Method Summary collapse
-
#initialize(alignment: ALIGNMENT_DEFAULT, distribution: DISTRIBUTION_DEFAULT, spacing: SPACING_DEFAULT, vertical: false, wrap: true, **system_arguments) ⇒ StackComponent
constructor
A new instance of StackComponent.
Methods included from ViewHelper
#polaris_body_styles, #polaris_html_classes, #polaris_html_styles, #polaris_icon_source
Methods included from StylesListHelper
Methods included from OptionHelper
#append_option, #prepend_option
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #fetch_or_fallback_nested
Methods included from ClassNameHelper
Constructor Details
#initialize(alignment: ALIGNMENT_DEFAULT, distribution: DISTRIBUTION_DEFAULT, spacing: SPACING_DEFAULT, vertical: false, wrap: true, **system_arguments) ⇒ StackComponent
Returns a new instance of StackComponent.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/components/polaris/stack_component.rb', line 42 def initialize( alignment: ALIGNMENT_DEFAULT, distribution: DISTRIBUTION_DEFAULT, spacing: SPACING_DEFAULT, vertical: false, wrap: true, **system_arguments ) @system_arguments = system_arguments @system_arguments[:tag] = "div" @system_arguments[:classes] = class_names( @system_arguments[:classes], "Polaris-LegacyStack", ALIGNMENT_MAPPINGS[fetch_or_fallback(ALIGNMENT_OPTIONS, alignment, ALIGNMENT_DEFAULT)], DISTRIBUTION_MAPPINGS[fetch_or_fallback(DISTRIBUTION_OPTIONS, distribution, DISTRIBUTION_DEFAULT)], SPACING_MAPPINGS[fetch_or_fallback(SPACING_OPTIONS, spacing, SPACING_DEFAULT)], "Polaris-LegacyStack--vertical": vertical, "Polaris-LegacyStack--noWrap": !wrap ) end |