summaryrefslogtreecommitdiff
path: root/spec/components/previews/pajamas/alert_component_preview.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/components/previews/pajamas/alert_component_preview.rb')
-rw-r--r--spec/components/previews/pajamas/alert_component_preview.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/components/previews/pajamas/alert_component_preview.rb b/spec/components/previews/pajamas/alert_component_preview.rb
new file mode 100644
index 00000000000..9a6b77715f5
--- /dev/null
+++ b/spec/components/previews/pajamas/alert_component_preview.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+module Pajamas
+ class AlertComponentPreview < ViewComponent::Preview
+ # @param body text
+ # @param dismissible toggle
+ # @param variant select [info, warning, success, danger, tip]
+ def default(body: nil, dismissible: true, variant: :info)
+ render(Pajamas::AlertComponent.new(
+ title: "Title",
+ dismissible: dismissible,
+ variant: variant.to_sym
+ )) do |c|
+ if body
+ c.with_body { body }
+ end
+ end
+ end
+ end
+end