Class: Polaris::ListComponent

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

Defined Under Namespace

Classes: ListItemComponent

Constant Summary collapse

TYPE_DEFAULT =
:bullet
TYPE_TAG_MAPPINGS =
{
  bullet: :ul,
  number: :ol
}
TYPE_CLASS_MAPPINGS =
{
  bullet: "",
  number: "Polaris-List--typeNumber"
}
TYPE_OPTIONS =
TYPE_TAG_MAPPINGS.keys
SPACING_DEFAULT =
:loose
SPACING_MAPPINGS =
{
  extra_tight: "Polaris-List--spacingExtraTight",
  loose: "Polaris-List--spacingLoose"
}
SPACING_OPTIONS =
SPACING_MAPPINGS.keys

Instance Method Summary collapse

Constructor Details

#initialize(type: TYPE_DEFAULT, spacing: SPACING_DEFAULT, **system_arguments) ⇒ ListComponent

Returns a new instance of ListComponent.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/components/polaris/list_component.rb', line 25

def initialize(
  type: TYPE_DEFAULT,
  spacing: SPACING_DEFAULT,
  **system_arguments
)
  @system_arguments = system_arguments
  @system_arguments[:tag] = TYPE_TAG_MAPPINGS[fetch_or_fallback(TYPE_OPTIONS, type, :ul)]
  @system_arguments[:classes] = class_names(
    @system_arguments[:classes],
    "Polaris-List",
    TYPE_CLASS_MAPPINGS[fetch_or_fallback(TYPE_OPTIONS, type, "")],
    SPACING_MAPPINGS[fetch_or_fallback(SPACING_OPTIONS, spacing, SPACING_DEFAULT)]
  )
end