summaryrefslogtreecommitdiff
path: root/app/components
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-10-20 09:40:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-20 09:40:42 +0000
commitee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch)
treef8479f94a28f66654c6a4f6fb99bad6b4e86a40e /app/components
parent62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff)
downloadgitlab-ce-ee664acb356f8123f4f6b00b73c1e1cf0866c7fb.tar.gz
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'app/components')
-rw-r--r--app/components/pajamas/alert_component.rb8
-rw-r--r--app/components/pajamas/progress_component.html.haml2
-rw-r--r--app/components/pajamas/progress_component.rb12
3 files changed, 18 insertions, 4 deletions
diff --git a/app/components/pajamas/alert_component.rb b/app/components/pajamas/alert_component.rb
index cfab34f537e..4475f4cde6e 100644
--- a/app/components/pajamas/alert_component.rb
+++ b/app/components/pajamas/alert_component.rb
@@ -12,8 +12,8 @@ module Pajamas
def initialize(
title: nil, variant: :info, dismissible: true, show_icon: true,
alert_options: {}, close_button_options: {})
- @title = title
- @variant = variant
+ @title = title.presence
+ @variant = filter_attribute(variant&.to_sym, VARIANT_ICONS.keys, default: :info)
@dismissible = dismissible
@show_icon = show_icon
@alert_options = alert_options
@@ -35,7 +35,7 @@ module Pajamas
renders_one :body
renders_one :actions
- ICONS = {
+ VARIANT_ICONS = {
info: 'information-o',
warning: 'warning',
success: 'check-circle',
@@ -44,7 +44,7 @@ module Pajamas
}.freeze
def icon
- ICONS[@variant]
+ VARIANT_ICONS[@variant]
end
def icon_classes
diff --git a/app/components/pajamas/progress_component.html.haml b/app/components/pajamas/progress_component.html.haml
new file mode 100644
index 00000000000..9368fe8b161
--- /dev/null
+++ b/app/components/pajamas/progress_component.html.haml
@@ -0,0 +1,2 @@
+.progress
+ .progress-bar{ class: "bg-#{@variant}", style: "width: #{@value}%;" }
diff --git a/app/components/pajamas/progress_component.rb b/app/components/pajamas/progress_component.rb
new file mode 100644
index 00000000000..1365da13863
--- /dev/null
+++ b/app/components/pajamas/progress_component.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+module Pajamas
+ class ProgressComponent < Pajamas::Component
+ def initialize(value: 0, variant: :primary)
+ @value = value
+ @variant = filter_attribute(variant, VARIANT_OPTIONS, default: :primary)
+ end
+
+ VARIANT_OPTIONS = [:primary, :success].freeze
+ end
+end