diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-16 15:07:40 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-16 15:07:40 +0000 |
commit | 0e1756ac5c275f8d548c06693b15578baf189d56 (patch) | |
tree | 095610add4bf2e78c66a2dec230438aaf599fdb2 /app/components | |
parent | 0045970352e8729b2797591beb88a7df884d84f4 (diff) | |
download | gitlab-ce-0e1756ac5c275f8d548c06693b15578baf189d56.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/components')
-rw-r--r-- | app/components/pajamas/alert_component.html.haml | 8 | ||||
-rw-r--r-- | app/components/pajamas/alert_component.rb | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/app/components/pajamas/alert_component.html.haml b/app/components/pajamas/alert_component.html.haml index 13c458f05e9..a7be57311bb 100644 --- a/app/components/pajamas/alert_component.html.haml +++ b/app/components/pajamas/alert_component.html.haml @@ -2,10 +2,10 @@ - if @show_icon = sprite_icon(icon, css_class: icon_classes) - if @dismissible - %button.btn.gl-dismiss-btn.btn-default.btn-sm.gl-button.btn-default-tertiary.btn-icon.js-close{ @close_button_options, - type: 'button', - aria: { label: _('Dismiss') } } - = sprite_icon('close') + = render Pajamas::ButtonComponent.new(category: :tertiary, + icon: 'close', + size: :small, + button_options: dismissible_button_options) .gl-alert-content{ role: 'alert' } - if @title %h4.gl-alert-title diff --git a/app/components/pajamas/alert_component.rb b/app/components/pajamas/alert_component.rb index 4475f4cde6e..008d624b7e2 100644 --- a/app/components/pajamas/alert_component.rb +++ b/app/components/pajamas/alert_component.rb @@ -50,5 +50,13 @@ module Pajamas def icon_classes "gl-alert-icon#{' gl-alert-icon-no-title' if @title.nil?}" end + + def dismissible_button_options + new_options = @close_button_options.deep_symbolize_keys # in case strings were used + new_options[:class] = "js-close gl-dismiss-btn #{new_options[:class]}" + new_options[:aria] ||= {} + new_options[:aria][:label] = _('Dismiss') # this will wipe out label if already present + new_options + end end end |