Class: IronAdmin::Ui::DropdownComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- IronAdmin::Ui::DropdownComponent
- Defined in:
- app/components/iron_admin/ui/dropdown_component.rb
Overview
Renders a dropdown menu with trigger and items.
Defined Under Namespace
Classes: ItemComponent
Instance Attribute Summary collapse
-
#align ⇒ Symbol
readonly
Dropdown alignment (:left, :right).
-
#width ⇒ Integer
readonly
Dropdown width in Tailwind units.
Instance Method Summary collapse
-
#dropdown_classes ⇒ String
private
CSS classes for dropdown panel.
-
#initialize(align: :right, width: 48) ⇒ DropdownComponent
constructor
A new instance of DropdownComponent.
-
#theme ⇒ IronAdmin::Configuration::Theme
private
Theme configuration.
Constructor Details
#initialize(align: :right, width: 48) ⇒ DropdownComponent
Returns a new instance of DropdownComponent.
25 26 27 28 |
# File 'app/components/iron_admin/ui/dropdown_component.rb', line 25 def initialize(align: :right, width: 48) @align = align @width = width end |
Instance Attribute Details
#align ⇒ Symbol (readonly)
Returns Dropdown alignment (:left, :right).
18 19 20 |
# File 'app/components/iron_admin/ui/dropdown_component.rb', line 18 def align @align end |
#width ⇒ Integer (readonly)
Returns Dropdown width in Tailwind units.
21 22 23 |
# File 'app/components/iron_admin/ui/dropdown_component.rb', line 21 def width @width end |
Instance Method Details
#dropdown_classes ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns CSS classes for dropdown panel.
38 39 40 41 42 43 |
# File 'app/components/iron_admin/ui/dropdown_component.rb', line 38 def dropdown_classes align_class = align == :right ? "right-0" : "left-0" width_class = "w-#{width}" "absolute #{align_class} mt-2 #{width_class} origin-top-#{align} #{theme.border_radius} " \ "#{theme.card_bg} border #{theme.card_border} #{theme.card_shadow}-lg z-50" end |
#theme ⇒ IronAdmin::Configuration::Theme
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Theme configuration.
32 33 34 |
# File 'app/components/iron_admin/ui/dropdown_component.rb', line 32 def theme IronAdmin.configuration.theme end |