Class: Keystone::Ui::AccordionComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Keystone::Ui::AccordionComponent
- Defined in:
- app/components/keystone/ui/accordion_component.rb
Constant Summary collapse
- BASE_CLASSES =
"flex flex-col gap-4"- ITEM_LAYOUT_CLASSES =
"rounded-xl border"- BUTTON_LAYOUT_CLASSES =
"flex w-full items-center justify-between px-6 py-4 text-left font-semibold transition"- ANSWER_LAYOUT_CLASSES =
"hidden px-6 pb-4 text-sm"- ICON_LAYOUT_CLASSES =
"shrink-0 transition-transform"- CARET_ICON =
<<~SVG.freeze <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" /></svg> SVG
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
- #answer_classes ⇒ Object
- #button_classes ⇒ Object
- #caret_icon ⇒ Object
- #classes ⇒ Object
- #icon_classes ⇒ Object
-
#initialize(items: []) ⇒ AccordionComponent
constructor
A new instance of AccordionComponent.
- #item_classes ⇒ Object
- #wrapper_data ⇒ Object
Constructor Details
#initialize(items: []) ⇒ AccordionComponent
Returns a new instance of AccordionComponent.
18 19 20 |
# File 'app/components/keystone/ui/accordion_component.rb', line 18 def initialize(items: []) @items = items end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
16 17 18 |
# File 'app/components/keystone/ui/accordion_component.rb', line 16 def items @items end |
Instance Method Details
#answer_classes ⇒ Object
34 35 36 |
# File 'app/components/keystone/ui/accordion_component.rb', line 34 def answer_classes "#{ANSWER_LAYOUT_CLASSES} text-surface-600 dark:text-surface-400" end |
#button_classes ⇒ Object
30 31 32 |
# File 'app/components/keystone/ui/accordion_component.rb', line 30 def "#{BUTTON_LAYOUT_CLASSES} text-surface-900 dark:text-white hover:text-accent-600 dark:hover:text-accent-400" end |
#caret_icon ⇒ Object
42 43 44 |
# File 'app/components/keystone/ui/accordion_component.rb', line 42 def caret_icon CARET_ICON end |
#classes ⇒ Object
22 23 24 |
# File 'app/components/keystone/ui/accordion_component.rb', line 22 def classes BASE_CLASSES end |
#icon_classes ⇒ Object
38 39 40 |
# File 'app/components/keystone/ui/accordion_component.rb', line 38 def icon_classes "#{ICON_LAYOUT_CLASSES} text-surface-400" end |
#item_classes ⇒ Object
26 27 28 |
# File 'app/components/keystone/ui/accordion_component.rb', line 26 def item_classes "#{ITEM_LAYOUT_CLASSES} border-surface-200 dark:border-surface-700" end |
#wrapper_data ⇒ Object
46 47 48 |
# File 'app/components/keystone/ui/accordion_component.rb', line 46 def wrapper_data { controller: "accordion" } end |