Commit fffb3db6 authored by Alexander Turinske's avatar Alexander Turinske

Update navigation badge to pajamas styling

- update gl_badge_helper to account for different
  icon sizes

Changelog: changed
parent 952a0852
...@@ -87,7 +87,12 @@ module BadgesHelper ...@@ -87,7 +87,12 @@ module BadgesHelper
if options[:icon] if options[:icon]
icon_classes = GL_ICON_CLASSES.dup icon_classes = GL_ICON_CLASSES.dup
icon_classes << "gl-mr-2" unless icon_only icon_classes << "gl-mr-2" unless icon_only
icon = sprite_icon(options[:icon], css_class: icon_classes.join(' '))
icon = if options[:icon_size]
sprite_icon(options[:icon], size: options[:icon_size], css_class: icon_classes.join(' '))
else
sprite_icon(options[:icon], css_class: icon_classes.join(' '))
end
content = icon_only ? icon : icon + content content = icon_only ? icon : icon + content
end end
......
- if ::Gitlab::ExternalAuthorization.enabled? && @project - if ::Gitlab::ExternalAuthorization.enabled? && @project
= content_for :header_content do = content_for :header_content do
%span.badge.color-label.gl-bg-red-500.has-tooltip{ title: s_('ExternalAuthorizationService|Classification label') } = gl_badge_tag(@project.external_authorization_classification_label, { variant: :danger, icon: 'lock-open', icon_size: 8 }, { class: 'has-tooltip', title: s_('ExternalAuthorizationService|Classification label') })
= sprite_icon('lock-open', size: 8, css_class: 'inline')
= @project.external_authorization_classification_label
...@@ -113,9 +113,13 @@ RSpec.describe BadgesHelper do ...@@ -113,9 +113,13 @@ RSpec.describe BadgesHelper do
it 'adds aria-label to element' do it 'adds aria-label to element' do
expect(subject).to match(%r{<span .*aria-label="#{label}".*>}) expect(subject).to match(%r{<span .*aria-label="#{label}".*>})
end end
end
describe 'icon size' do
subject { helper.gl_badge_tag(label, icon: 'question-o', icon_size: 8) }
it 'does not add a spacing class to the icon' do it 'adds an img role to element' do
expect(subject).not_to match(spacing_class_regex) expect(subject).to match(%r{<svg .*class="s8.*".*>})
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment