Class: Maglev::Uikit::ModalComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Maglev::Uikit::ModalComponent
- Defined in:
- app/components/maglev/uikit/modal_component.rb
Instance Attribute Summary collapse
-
#focus ⇒ Object
readonly
Returns the value of attribute focus.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#open ⇒ Object
readonly
Returns the value of attribute open.
Instance Method Summary collapse
- #dialog_classes ⇒ Object
-
#initialize(id:, open: false, focus: true, size: 'default') ⇒ ModalComponent
constructor
A new instance of ModalComponent.
Methods inherited from BaseComponent
Constructor Details
#initialize(id:, open: false, focus: true, size: 'default') ⇒ ModalComponent
Returns a new instance of ModalComponent.
12 13 14 15 16 17 |
# File 'app/components/maglev/uikit/modal_component.rb', line 12 def initialize(id:, open: false, focus: true, size: 'default') @id = id @open = open @focus = focus @size = size end |
Instance Attribute Details
#focus ⇒ Object (readonly)
Returns the value of attribute focus.
10 11 12 |
# File 'app/components/maglev/uikit/modal_component.rb', line 10 def focus @focus end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'app/components/maglev/uikit/modal_component.rb', line 10 def id @id end |
#open ⇒ Object (readonly)
Returns the value of attribute open.
10 11 12 |
# File 'app/components/maglev/uikit/modal_component.rb', line 10 def open @open end |
Instance Method Details
#dialog_classes ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/components/maglev/uikit/modal_component.rb', line 19 def dialog_classes class_variants( base: %( relative transform overflow-y-visible rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:p-6 hidden ), variants: { size: { small: 'w-full sm:max-w-xl sm:min-w-96 sm:w-auto' } }, defaults: { size: :default } ).render(size: @size) end |