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

Constants included from ViewHelper

ViewHelper::POLARIS_HELPERS, ViewHelper::POLARIS_TEXT_STYLES

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Instance Method Summary collapse

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

#class_names

Constructor Details

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

Returns a new instance of ListComponent.



18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/components/polaris/list_component.rb', line 18

def initialize(
  type: TYPE_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, "")]
  )
end