Class: Polaris::ActionList::SectionComponent

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

Instance Method Summary collapse

Constructor Details

#initialize(position: 1, title: nil, **system_arguments) ⇒ SectionComponent

Returns a new instance of SectionComponent.



4
5
6
7
8
# File 'app/components/polaris/action_list/section_component.rb', line 4

def initialize(position: 1, title: nil, **system_arguments)
  @position = position
  @title = title
  @system_arguments = system_arguments
end

Instance Method Details

#system_argumentsObject



10
11
12
13
14
15
16
17
18
# File 'app/components/polaris/action_list/section_component.rb', line 10

def system_arguments
  @system_arguments.tap do |opts|
    opts[:tag] = "div"
    opts[:classes] = class_names(
      @system_arguments[:classes],
      "Polaris-ActionList__Section--withoutTitle": @title.blank?
    )
  end
end

#title_classesObject



20
21
22
23
24
25
# File 'app/components/polaris/action_list/section_component.rb', line 20

def title_classes
  class_names(
    "Polaris-ActionList__Title",
    "Polaris-ActionList--firstSectionWithTitle": @position == 1
  )
end