Class: Satis::Card::Component
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Satis::Card::Component
- Defined in:
- app/components/satis/card/component.rb
Instance Attribute Summary collapse
-
#content_padding ⇒ Object
readonly
Returns the value of attribute content_padding.
-
#custom_tabs_link_html ⇒ Object
readonly
Returns the value of attribute custom_tabs_link_html.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#header_background_color ⇒ Object
readonly
Returns the value of attribute header_background_color.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#initial_actions ⇒ Object
readonly
Returns the value of attribute initial_actions.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#menu ⇒ Object
readonly
Returns the value of attribute menu.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Attributes inherited from ApplicationComponent
Instance Method Summary collapse
- #custom_tabs_link(&block) ⇒ Object
- #header? ⇒ Boolean
-
#initialize(icon: nil, title: nil, description: nil, menu: nil, content_padding: true, header_background_color: { dark: 'bg-gray-800', light: 'bg-white' }, actions: [], key: nil) ⇒ Component
constructor
A new instance of Component.
- #tabs? ⇒ Boolean
Methods inherited from ApplicationComponent
add_helper, #component_name, #ct, #i18n_scope, #original_i18n_scope, #original_virtual_path
Constructor Details
#initialize(icon: nil, title: nil, description: nil, menu: nil, content_padding: true, header_background_color: { dark: 'bg-gray-800', light: 'bg-white' }, actions: [], key: nil) ⇒ Component
Returns a new instance of Component.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/components/satis/card/component.rb', line 12 def initialize(icon: nil, title: nil, description: nil, menu: nil, content_padding: true, header_background_color: { dark: 'bg-gray-800', light: 'bg-white' }, actions: [], key: nil) super @title = title @title = @title.reject(&:blank?).compact.join(' ') if @title.is_a?(Array) @description = description @icon = icon @menu = @content_padding = content_padding @header_background_color = header_background_color @initial_actions = actions @key = key end |
Instance Attribute Details
#content_padding ⇒ Object (readonly)
Returns the value of attribute content_padding.
10 11 12 |
# File 'app/components/satis/card/component.rb', line 10 def content_padding @content_padding end |
#custom_tabs_link_html ⇒ Object (readonly)
Returns the value of attribute custom_tabs_link_html.
10 11 12 |
# File 'app/components/satis/card/component.rb', line 10 def custom_tabs_link_html @custom_tabs_link_html end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
10 11 12 |
# File 'app/components/satis/card/component.rb', line 10 def description @description end |
#header_background_color ⇒ Object (readonly)
Returns the value of attribute header_background_color.
10 11 12 |
# File 'app/components/satis/card/component.rb', line 10 def header_background_color @header_background_color end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
10 11 12 |
# File 'app/components/satis/card/component.rb', line 10 def icon @icon end |
#initial_actions ⇒ Object (readonly)
Returns the value of attribute initial_actions.
10 11 12 |
# File 'app/components/satis/card/component.rb', line 10 def initial_actions @initial_actions end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
10 11 12 |
# File 'app/components/satis/card/component.rb', line 10 def key @key end |
#menu ⇒ Object (readonly)
Returns the value of attribute menu.
10 11 12 |
# File 'app/components/satis/card/component.rb', line 10 def @menu end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
10 11 12 |
# File 'app/components/satis/card/component.rb', line 10 def title @title end |
Instance Method Details
#custom_tabs_link(&block) ⇒ Object
34 35 36 37 |
# File 'app/components/satis/card/component.rb', line 34 def custom_tabs_link(&block) return unless block_given? @custom_tabs_link_html = block.call.html_safe end |
#header? ⇒ Boolean
43 44 45 |
# File 'app/components/satis/card/component.rb', line 43 def header? icon.present? || title.present? || description.present? || end |
#tabs? ⇒ Boolean
39 40 41 |
# File 'app/components/satis/card/component.rb', line 39 def tabs? tabs.present? end |