Class: Polaris::TextContainerComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/polaris/text_container_component.rb

Constant Summary collapse

SPACING_DEFAULT =
:default
SPACING_MAPPINGS =
{
  SPACING_DEFAULT => "",
  :tight => "Polaris-TextContainer--spacingTight",
  :loose => "Polaris-TextContainer--spacingLoose"
}
SPACING_OPTIONS =
SPACING_MAPPINGS.keys

Instance Method Summary collapse

Constructor Details

#initialize(spacing: SPACING_DEFAULT, **system_arguments) ⇒ TextContainerComponent

Returns a new instance of TextContainerComponent.



13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/components/polaris/text_container_component.rb', line 13

def initialize(
  spacing: SPACING_DEFAULT,
  **system_arguments
)
  @system_arguments = system_arguments
  @system_arguments[:tag] = "div"
  @system_arguments[:classes] = class_names(
    @system_arguments[:classes],
    "Polaris-TextContainer",
    SPACING_MAPPINGS[fetch_or_fallback(SPACING_OPTIONS, spacing, SPACING_DEFAULT)]
  )
end

Instance Method Details

#call ⇒ Object



26
27
28
# File 'app/components/polaris/text_container_component.rb', line 26

def call
  render(Polaris::BaseComponent.new(**@system_arguments)) { content }
end