Sha256: 13626c302748567dc95338e3d909971b3e9d212c58c8420eb44b4fd4bcbf136f

Contents?: true

Size: 581 Bytes

Versions: 25

Compression:

Stored size: 581 Bytes

Contents

module Coco
  class Toast < Coco::Component
    include Concerns::WrapsComponent
    include Concerns::ActsAsNotification

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

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

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

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
coveragebook_components-0.19.8 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.19.7 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.19.6 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.19.5 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.19.4 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.19.3 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.19.2 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.19.1 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.19.0 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.18.8 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.18.7 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.18.0 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.17.7 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.17.6 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.17.5 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.17.4 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.17.3 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.17.2 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.17.1 app/components/coco/messaging/toast/toast.rb
coveragebook_components-0.17.0 app/components/coco/messaging/toast/toast.rb