Class: Polaris::ExceptionList::ItemComponent

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

Constant Summary collapse

STATUS_DEFAULT =
:default
STATUS_MAPPINGS =
{
  STATUS_DEFAULT => "",
  :critical => "Polaris-ExceptionList--statusCritical",
  :warning => "Polaris-ExceptionList--statusWarning"
}
STATUS_OPTIONS =
STATUS_MAPPINGS.keys

Instance Method Summary collapse

Constructor Details

#initialize(icon: nil, title: nil, status: STATUS_DEFAULT, **system_arguments) ⇒ ItemComponent

Returns a new instance of ItemComponent.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/components/polaris/exception_list/item_component.rb', line 10

def initialize(
  icon: nil,
  title: nil,
  status: STATUS_DEFAULT,
  **system_arguments
)
  @icon = icon
  @title = title

  @system_arguments = system_arguments
  @system_arguments[:tag] = "li"
  @system_arguments[:classes] = class_names(
    @system_arguments[:classes],
    "Polaris-ExceptionList__Item",
    STATUS_MAPPINGS[fetch_or_fallback(STATUS_OPTIONS, status, STATUS_DEFAULT)]
  )
end