blob: 34cc386763f60fbd8c40e858a06c9e8e68632976 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# frozen_string_literal: true
module Pajamas
class SpinnerComponentPreview < ViewComponent::Preview
# Spinner
# ----
# See its design reference [here](https://design.gitlab.com/components/spinner).
#
# @param inline toggle
# @param label text
# @param size select {{ Pajamas::SpinnerComponent::SIZE_OPTIONS }}
def default(inline: false, label: "Loading", size: :md)
render Pajamas::SpinnerComponent.new(
inline: inline,
label: label,
size: size
)
end
# Use a light spinner on dark backgrounds.
#
# @display bg_dark true
def light
render(Pajamas::SpinnerComponent.new(color: :light))
end
# Any extra HTML attributes like `class`, `data` or `id` get automatically applied to the spinner container element.
#
def extra_attributes
render Pajamas::SpinnerComponent.new(
class: "js-do-something",
data: { foo: "bar" },
id: "my-special-spinner"
)
end
end
end
|