Class: Maglev::Uikit::List::InsertButtonComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Maglev::Uikit::List::InsertButtonComponent
- Defined in:
- app/components/maglev/uikit/list/insert_button_component.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
Instance Method Summary collapse
- #color_class ⇒ Object
-
#initialize(link:, index: nil) ⇒ InsertButtonComponent
constructor
A new instance of InsertButtonComponent.
- #link_data ⇒ Object
- #link_url ⇒ Object
- #wrapper_classes ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(link:, index: nil) ⇒ InsertButtonComponent
Returns a new instance of InsertButtonComponent.
9 10 11 12 |
# File 'app/components/maglev/uikit/list/insert_button_component.rb', line 9 def initialize(link:, index: nil) @link = link @index = index end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
7 8 9 |
# File 'app/components/maglev/uikit/list/insert_button_component.rb', line 7 def index @index end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
7 8 9 |
# File 'app/components/maglev/uikit/list/insert_button_component.rb', line 7 def link @link end |
Instance Method Details
#color_class ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'app/components/maglev/uikit/list/insert_button_component.rb', line 22 def color_class [ 'bg-gray-500/20', 'bg-red-500/20', 'bg-blue-500/20', 'bg-green-500/20', 'bg-yellow-500/20' ][index] end |
#link_data ⇒ Object
18 19 20 |
# File 'app/components/maglev/uikit/list/insert_button_component.rb', line 18 def link_data link[:data] || {} end |
#link_url ⇒ Object
14 15 16 |
# File 'app/components/maglev/uikit/list/insert_button_component.rb', line 14 def link_url link[:url] end |
#wrapper_classes ⇒ Object
32 33 34 35 36 |
# File 'app/components/maglev/uikit/list/insert_button_component.rb', line 32 def wrapper_classes(...) class_variants( base: 'relative w-full h-7 group/button z-10 -mb-5 -mt-5 group-[.is-dragging]:hidden' ).render(...) end |