diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-07 15:11:00 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-07 15:11:00 +0000 |
commit | fa4473a48706d074217f4ffc8d183cf630af1833 (patch) | |
tree | 6e2ae917c1351d24d0b5b65a86fd9da3cddb8bab /app/components | |
parent | 1dab074ef1740798bcba5f8468b09e5f378fe0f4 (diff) | |
download | gitlab-ce-fa4473a48706d074217f4ffc8d183cf630af1833.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/components')
-rw-r--r-- | app/components/pajamas/spinner_component.html.haml | 7 | ||||
-rw-r--r-- | app/components/pajamas/spinner_component.rb | 13 |
2 files changed, 11 insertions, 9 deletions
diff --git a/app/components/pajamas/spinner_component.html.haml b/app/components/pajamas/spinner_component.html.haml index aab9c5fdbf7..b319f3b1632 100644 --- a/app/components/pajamas/spinner_component.html.haml +++ b/app/components/pajamas/spinner_component.html.haml @@ -1,5 +1,2 @@ -.gl-spinner-container{ class: @class } - - if @inline - %span{ class: spinner_class, aria: {label: @label} } - - else - %div{ class: spinner_class, aria: {label: @label} } += content_tag (@inline ? :span : :div), **html_options do + %span{ class: spinner_class, aria: {label: @label} }> diff --git a/app/components/pajamas/spinner_component.rb b/app/components/pajamas/spinner_component.rb index c7ffc1ec3da..b8e095bb73e 100644 --- a/app/components/pajamas/spinner_component.rb +++ b/app/components/pajamas/spinner_component.rb @@ -2,26 +2,31 @@ module Pajamas class SpinnerComponent < Pajamas::Component - # @param [String] class # @param [Symbol] color # @param [Boolean] inline # @param [String] label # @param [Symbol] size - def initialize(class: '', color: :dark, inline: false, label: _("Loading"), size: :sm) - @class = binding.local_variable_get(:class) + def initialize(color: :dark, inline: false, label: _("Loading"), size: :sm, **html_options) @color = filter_attribute(color.to_sym, COLOR_OPTIONS) @inline = inline @label = label.presence @size = filter_attribute(size.to_sym, SIZE_OPTIONS) + @html_options = html_options end private def spinner_class - ["gl-spinner", "gl-spinner-#{@size}", "gl-spinner-#{@color}"] + ["gl-spinner", "gl-spinner-#{@size}", "gl-spinner-#{@color} gl-vertical-align-text-bottom!"] end COLOR_OPTIONS = [:light, :dark].freeze SIZE_OPTIONS = [:sm, :md, :lg, :xl].freeze + + def html_options + options = format_options(options: @html_options, css_classes: "gl-spinner-container") + options[:role] = "status" + options + end end end |