Sha256: ab46aed9bcef063cadca8ba8196c05f79d10dbd477521ae983f33cfd8fa78bbd

Contents?: true

Size: 700 Bytes

Versions: 14

Compression:

Stored size: 700 Bytes

Contents

module Coco
  class Notice < Coco::Component
    include Concerns::AcceptsOptions
    include Concerns::WrapsComponent

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

    wraps_component :alert do |args|
      Coco::Alert.new(**args, cloak: false, dismissable: get_option_value(:dismissable))
    end

    %i[title action secondary_action link].each do |slot_name|
      renders_one slot_name, ->(*args, **kwargs, &block) do
        alert.send(:"with_#{slot_name}", *args, **kwargs, &block)
      end
    end

    before_render do
      with_title { @title } unless title? || @title.nil?
    end

    def initialize(title: nil, **kwargs)
      @title = title
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
coveragebook_components-0.19.8 app/components/coco/messaging/notice/notice.rb
coveragebook_components-0.19.7 app/components/coco/messaging/notice/notice.rb
coveragebook_components-0.19.6 app/components/coco/messaging/notice/notice.rb
coveragebook_components-0.19.5 app/components/coco/messaging/notice/notice.rb
coveragebook_components-0.19.4 app/components/coco/messaging/notice/notice.rb
coveragebook_components-0.19.3 app/components/coco/messaging/notice/notice.rb
coveragebook_components-0.19.2 app/components/coco/messaging/notice/notice.rb
coveragebook_components-0.19.1 app/components/coco/messaging/notice/notice.rb
coveragebook_components-0.19.0 app/components/coco/messaging/notice/notice.rb
coveragebook_components-0.18.8 app/components/coco/messaging/notice/notice.rb
coveragebook_components-0.18.7 app/components/coco/messaging/notice/notice.rb
coveragebook_components-0.18.0 app/components/coco/messaging/notice/notice.rb
coveragebook_components-0.17.7 app/components/coco/messaging/notice/notice.rb
coveragebook_components-0.17.6 app/components/coco/messaging/notice/notice.rb