debian-mirror-gitlab/spec/components/previews/pajamas/alert_component_preview.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
636 B
Ruby
Raw Normal View History

2022-08-27 11:52:29 +05:30
# frozen_string_literal: true
module Pajamas
class AlertComponentPreview < ViewComponent::Preview
2022-11-25 23:54:43 +05:30
# @param title text
2022-08-27 11:52:29 +05:30
# @param body text
# @param dismissible toggle
2023-01-13 00:05:48 +05:30
# @param variant select {{ Pajamas::AlertComponent::VARIANT_ICONS.keys }}
2022-11-25 23:54:43 +05:30
def default(title: "Alert title (optional)", body: "Alert message goes here.", dismissible: true, variant: :info)
2022-08-27 11:52:29 +05:30
render(Pajamas::AlertComponent.new(
2022-11-25 23:54:43 +05:30
title: title,
2022-08-27 11:52:29 +05:30
dismissible: dismissible,
variant: variant.to_sym
)) do |c|
if body
c.with_body { body }
end
end
end
end
end