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

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

37 lines
1,008 B
Ruby
Raw Normal View History

2022-08-27 11:52:29 +05:30
# 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
2023-01-13 00:05:48 +05:30
# @param size select {{ Pajamas::SpinnerComponent::SIZE_OPTIONS }}
2022-08-27 11:52:29 +05:30
def default(inline: false, label: "Loading", size: :md)
2023-01-13 00:05:48 +05:30
render Pajamas::SpinnerComponent.new(
inline: inline,
label: label,
size: size
)
2022-08-27 11:52:29 +05:30
end
2023-01-13 00:05:48 +05:30
# Use a light spinner on dark backgrounds.
2022-08-27 11:52:29 +05:30
#
2023-01-13 00:05:48 +05:30
# @display bg_dark true
2022-08-27 11:52:29 +05:30
def light
render(Pajamas::SpinnerComponent.new(color: :light))
end
2023-01-13 00:05:48 +05:30
# 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
2022-08-27 11:52:29 +05:30
end
end