Welcome to mirror list, hosted at ThFree Co, Russian Federation.

alert_component_preview.rb « pajamas « previews « components « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4768ef47975a20c0597229abeb10359b7dad471d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true
module Pajamas
  class AlertComponentPreview < ViewComponent::Preview
    # @param title text
    # @param body text
    # @param dismissible toggle
    # @param variant select {{ Pajamas::AlertComponent::VARIANT_ICONS.keys }}
    def default(title: "Alert title (optional)", body: "Alert message goes here.", 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