Class: CodengageViewComponents::TurboModalComponent

Inherits:
ApplicationComponent show all
Defined in:
app/components/codengage_view_components/turbo_modal_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(title: nil, icon: nil, size: :lg, without_close: false, options: {}) ⇒ TurboModalComponent

Returns a new instance of TurboModalComponent.



7
8
9
10
11
12
13
# File 'app/components/codengage_view_components/turbo_modal_component.rb', line 7

def initialize(title: nil, icon: nil, size: :lg, without_close: false, options: {})
  @title = title
  @icon = icon
  @size = size
  @without_close = without_close
  @options = options
end

Instance Method Details



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/components/codengage_view_components/turbo_modal_component.rb', line 15

def modal_size_class
  case @size
  when :sm
    "sm:max-w-sm"
  when :md
    "sm:max-w-md"
  when :lg
    "sm:max-w-lg"
  when :xl
    "sm:max-w-xl"
  when :xl2
    "sm:max-w-2xl"
  when :xl3
    "sm:max-w-3xl"
  when :xl4
    "sm:max-w-4xl"
  when :xl5
    "sm:max-w-5xl"
  when :xl6
    "sm:max-w-6xl"
  when :xl7
    "sm:max-w-7xl"
  when :xl8
    "sm:max-w-[1500px]"
  when :full
    "sm:max-w-full"
  else
    "sm:max-w-lg"
  end
end