Class: Primer::Alpha::Stack
- Defined in:
- app/components/primer/alpha/stack.rb
Overview
Stack is a layout component that creates responsive horizontal and vertical flows.
Defined Under Namespace
Classes: AlignArg, DirectionArg, GapArg, JustifyArg, PaddingArg, WrapArg
Constant Summary collapse
- DEFAULT_TAG =
:div
- ARG_CLASSES =
[ JustifyArg, DirectionArg, AlignArg, WrapArg, PaddingArg, GapArg ].freeze
Constants inherited from Component
Component::INVALID_ARIA_LABEL_TAGS
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from TestSelectorHelper
TestSelectorHelper::TEST_SELECTOR_TAG
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Constants included from Primer::AttributesHelper
Primer::AttributesHelper::PLURAL_ARIA_ATTRIBUTES, Primer::AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Method Summary collapse
-
#initialize(tag: DEFAULT_TAG, justify: JustifyArg::DEFAULT, gap: GapArg::DEFAULT, direction: DirectionArg::DEFAULT, align: AlignArg::DEFAULT, wrap: WrapArg::DEFAULT, padding: PaddingArg::DEFAULT, **system_arguments) ⇒ Stack
constructor
A new instance of Stack.
Methods inherited from Component
Methods included from JoinStyleArgumentsHelper
Methods included from TestSelectorHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Methods included from Primer::AttributesHelper
#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes
Methods included from ExperimentalSlotHelpers
Methods included from ExperimentalRenderHelpers
Constructor Details
#initialize(tag: DEFAULT_TAG, justify: JustifyArg::DEFAULT, gap: GapArg::DEFAULT, direction: DirectionArg::DEFAULT, align: AlignArg::DEFAULT, wrap: WrapArg::DEFAULT, padding: PaddingArg::DEFAULT, **system_arguments) ⇒ Stack
Returns a new instance of Stack.
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'app/components/primer/alpha/stack.rb', line 152 def initialize( tag: DEFAULT_TAG, justify: JustifyArg::DEFAULT, gap: GapArg::DEFAULT, direction: DirectionArg::DEFAULT, align: AlignArg::DEFAULT, wrap: WrapArg::DEFAULT, padding: PaddingArg::DEFAULT, **system_arguments ) @system_arguments = system_arguments @system_arguments[:tag] = tag @system_arguments[:classes] = class_names( @system_arguments.delete(:classes), "Stack" ) @system_arguments[:data] = merge_data( @system_arguments, { data: { **JustifyArg.for(justify).to_data_attributes, **GapArg.for(gap).to_data_attributes, **DirectionArg.for(direction).to_data_attributes, **AlignArg.for(align).to_data_attributes, **WrapArg.for(wrap).to_data_attributes, **PaddingArg.for(padding).to_data_attributes, } } ) end |