Method: Satis::Card::Component#initialize

Defined in:
app/components/satis/card/component.rb

#initialize(identifier = nil, icon: nil, title: nil, description: nil, menu: nil, content_padding: true, header_background_color: { dark: 'bg-gray-800', light: 'bg-white' }, custom_tabs_link: nil, scope: [], actions: [], key: nil, persist: true) ⇒ Component

Returns a new instance of Component.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/components/satis/card/component.rb', line 13

def initialize(identifier = nil,
               icon: nil,
               title: nil,
               description: nil,
               menu: nil,
               content_padding: true,
               header_background_color: {
                 dark: 'bg-gray-800', light: 'bg-white'
               },
               custom_tabs_link: nil,
               scope: [],
               actions: [],
               key: nil,
               persist: true)
  super

  if identifier.blank?
    ActiveSupport::Deprecation.warn('Calling sts.card with the id parameter will become mandatory')
  end

  @identifier = identifier
  @title = title
  @title = @title.reject(&:blank?).compact.join(' ') if @title.is_a?(Array)
  @description = description
  @icon = icon
  @menu = menu
  @content_padding = content_padding
  @header_background_color = header_background_color
  @initial_actions = actions
  @persist = persist
  @key = key
  @custom_tabs_link = custom_tabs_link
  @scope = scope.present? ? scope : identifier
end