Class: DesignSystem::Generic::ListComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- DesignSystem::Generic::ListComponent
- Defined in:
- app/components/design_system/generic/list_component.rb
Overview
Plain, bullet, or numbered list rendered by ds_list.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#list ⇒ Object
readonly
Returns the value of attribute list.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(list:, type: :default, **options) ⇒ ListComponent
constructor
A new instance of ListComponent.
- #list_options ⇒ Object
- #tag_name ⇒ Object
Methods included from Helpers::CssHelper
Methods included from BrandDerivable
Constructor Details
#initialize(list:, type: :default, **options) ⇒ ListComponent
Returns a new instance of ListComponent.
5 6 7 8 9 10 |
# File 'app/components/design_system/generic/list_component.rb', line 5 def initialize(list:, type: :default, **) super() @list = list @type = type.to_sym @options = end |
Instance Attribute Details
#list ⇒ Object (readonly)
Returns the value of attribute list.
12 13 14 |
# File 'app/components/design_system/generic/list_component.rb', line 12 def list @list end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
12 13 14 |
# File 'app/components/design_system/generic/list_component.rb', line 12 def @options end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
12 13 14 |
# File 'app/components/design_system/generic/list_component.rb', line 12 def type @type end |
Instance Method Details
#list_options ⇒ Object
18 19 20 21 22 23 |
# File 'app/components/design_system/generic/list_component.rb', line 18 def classes = ["#{brand}-list"] classes << "#{brand}-list--bullet" if type == :bullet classes << "#{brand}-list--number" if type == :number (, classes) end |
#tag_name ⇒ Object
14 15 16 |
# File 'app/components/design_system/generic/list_component.rb', line 14 def tag_name type == :number ? :ol : :ul end |