Sha256: 2a94d8643bb2f03b6c9f85d48933a25079653a4100f1aa6a8c6eccece12ef949

Contents?: true

Size: 531 Bytes

Versions: 7

Compression:

Stored size: 531 Bytes

Contents

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

    accepts_option :dismissable, from: [true, false], default: true

    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

7 entries across 7 versions & 1 rubygems

Version Path
coveragebook_components-0.17.2 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.17.1 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.17.0 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.16.0 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.15.0 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.14.0 app/components/coco/modals/modal_dialog/modal_dialog.rb
coveragebook_components-0.13.1 app/components/coco/modals/modal_dialog/modal_dialog.rb