Class: SolidusAdmin::UI::Dropdown::Component
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- SolidusAdmin::UI::Dropdown::Component
- Defined in:
- app/components/solidus_admin/ui/dropdown/component.rb
Constant Summary collapse
- DIRECTIONS =
{ left: "right-0", right: "left-0", }
- SIZES =
{ s: "w-5 h-5", m: "w-[22px] h-[22px]", }
Instance Method Summary collapse
-
#initialize(text: nil, size: :m, direction: :left, **attributes) ⇒ Component
constructor
A new instance of Component.
Constructor Details
#initialize(text: nil, size: :m, direction: :left, **attributes) ⇒ Component
Returns a new instance of Component.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/components/solidus_admin/ui/dropdown/component.rb', line 14 def initialize(text: nil, size: :m, direction: :left, **attributes) @text = text @size = size @attributes = attributes @direction = direction @attributes[:"data-controller"] = "#{stimulus_id} #{attributes[:"data-controller"]}" @attributes[:"data-action"] = "turbo:before-cache@window->#{stimulus_id}#close #{attributes[:"data-action"]}" @attributes[:class] = " font-normal #{@size == :m ? 'text-base' : 'text-sm'} #{@attributes[:class]} " end |