Class: Avo::ModalComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/avo/modal_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width: :md, body_class: nil) ⇒ ModalComponent

Returns a new instance of ModalComponent.



10
11
12
13
# File 'app/components/avo/modal_component.rb', line 10

def initialize(width: :md, body_class: nil)
  @width = width
  @body_class = body_class
end

Instance Attribute Details

#body_classObject (readonly)

Returns the value of attribute body_class.



8
9
10
# File 'app/components/avo/modal_component.rb', line 8

def body_class
  @body_class
end

#widthObject (readonly)

Returns the value of attribute width.



7
8
9
# File 'app/components/avo/modal_component.rb', line 7

def width
  @width
end

Instance Method Details

#height_classesObject



24
25
26
# File 'app/components/avo/modal_component.rb', line 24

def height_classes
  "max-h-full min-h-1/4 max-h-11/12"
end

#width_classesObject



15
16
17
18
19
20
21
22
# File 'app/components/avo/modal_component.rb', line 15

def width_classes
  case width.to_sym
  when :md
    "w-11/12 lg:w-1/2 sm:max-w-168"
  when :xl
    "w-11/12 lg:w-3/4"
  end
end