app/components/coco/messaging/alert/alert.rb in coveragebook_components-0.19.5 vs app/components/coco/messaging/alert/alert.rb in coveragebook_components-0.19.6
- old
+ new
@@ -10,10 +10,11 @@
accepts_option :banner, from: [true, false], default: false
accepts_option :theme, from: THEMES, default: "info"
accepts_option :single_line, from: [true, false]
accepts_option :cloak, from: [true, false], default: true, private: true
accepts_option :condensed, from: [true, false], default: false
+ accepts_option :icon, default: true
renders_one :title
renders_one :message
renders_one :action, ->(*args, **kwargs, &block) do
@@ -66,15 +67,20 @@
def button_size
get_option_value(:condensed) ? :xs : :sm
end
def stamp
- type = unvividify(get_option_value(:theme))&.to_sym
style = if get_option_value(:banner)
:compact
else
vivid? ? :inverse : :subtle
end
- coco_stamp(type, style:)
+
+ if get_option_value(:icon) == true
+ type = unvividify(get_option_value(:theme))&.to_sym
+ coco_stamp(type, style:)
+ elsif get_option_value(:icon).present?
+ coco_stamp(icon: get_option_value(:icon), style:)
+ end
end
end
end