Sha256: d5dc796f78dd4d40dbbdc6167c0ece800bfef60aa005c44c36e4fe0f3a1ab6f5

Contents?: true

Size: 696 Bytes

Versions: 17

Compression:

Stored size: 696 Bytes

Contents

module Coco
  class ModalDialog < Coco::Component
    include Concerns::AcceptsOptions

    accepts_option :dismissable, from: [true, false], default: true
    accepts_option :size, from: [:sm, :md, :lg], default: :md

    renders_one :notice, ->(**kwargs) do
      Coco::Notice.new(**kwargs, dismissable: false)
    end

    renders_one :title

    before_render do
      unless title?
        raise ArgumentError, "A title is required for modal dialogs"
      end
    end

    def initialize(**kwargs)
      with_title { kwargs[:title] } if kwargs[:title]
    end

    def header?
      title || dismissable?
    end

    def dismissable?
      get_option_value(:dismissable)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
coveragebook_components-0.19.8 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.19.7 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.19.6 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.19.5 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.19.4 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.19.3 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.19.2 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.19.1 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.19.0 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.18.8 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.18.7 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.18.0 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.17.7 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.17.6 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.17.5 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.17.4 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.17.3 app/components/coco/modals/modal_dialog/modal_dialog.rb