Sha256: f75db936ae4e561e2640b8b06432c8f3cb1faca2a0d26ad805602b100f4f55e7

Contents?: true

Size: 609 Bytes

Versions: 3

Compression:

Stored size: 609 Bytes

Contents

# frozen_string_literal: true

class Avo::ModalComponent < Avo::BaseComponent
  renders_one :heading
  renders_one :controls

  attr_reader :width
  attr_reader :body_class

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

  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

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

  def overflow_classes
    @overflow == :auto ? "overflow-auto" : ""
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
avo-3.11.7 app/components/avo/modal_component.rb
avo-3.11.6 app/components/avo/modal_component.rb
avo-3.11.5 app/components/avo/modal_component.rb