Commit 936877b3 authored by Simon Knox's avatar Simon Knox

Merge branch '224510-replace-fa-chevron-up-with-gitlab-svg-chevron-up-icon' into 'master'

Replace fa-chevron-up with GitLab SVG icon

See merge request gitlab-org/gitlab!46118
parents e81bb02f c059a155
...@@ -12,11 +12,19 @@ import { getLocationHash } from '../lib/utils/url_utility'; ...@@ -12,11 +12,19 @@ import { getLocationHash } from '../lib/utils/url_utility';
$(() => { $(() => {
function toggleContainer(container, toggleState) { function toggleContainer(container, toggleState) {
const $container = $(container); const $container = $(container);
const isExpanded = $container.data('is-expanded');
$container const $collapseIcon = $container.find('.js-sidebar-collapse');
.find('.js-toggle-button .fa-chevron-up, .js-toggle-button .fa-chevron-down') const $expandIcon = $container.find('.js-sidebar-expand');
.toggleClass('fa-chevron-up', toggleState)
.toggleClass('fa-chevron-down', toggleState !== undefined ? !toggleState : undefined); if (isExpanded && !toggleState) {
$container.data('is-expanded', false);
$collapseIcon.addClass('hidden');
$expandIcon.removeClass('hidden');
} else {
$container.data('is-expanded', true);
$expandIcon.addClass('hidden');
$collapseIcon.removeClass('hidden');
}
$container.find('.js-toggle-content').toggle(toggleState); $container.find('.js-toggle-content').toggle(toggleState);
} }
......
...@@ -65,8 +65,8 @@ export default { ...@@ -65,8 +65,8 @@ export default {
}; };
}, },
computed: { computed: {
toggleChevronClass() { toggleChevronIconName() {
return this.expanded ? 'fa-chevron-up' : 'fa-chevron-down'; return this.expanded ? 'chevron-up' : 'chevron-down';
}, },
noteTimestampLink() { noteTimestampLink() {
return this.noteId ? `#note_${this.noteId}` : undefined; return this.noteId ? `#note_${this.noteId}` : undefined;
...@@ -133,7 +133,7 @@ export default { ...@@ -133,7 +133,7 @@ export default {
type="button" type="button"
@click="handleToggle" @click="handleToggle"
> >
<i ref="chevronIcon" :class="toggleChevronClass" class="fa" aria-hidden="true"></i> <gl-icon ref="chevronIcon" :name="toggleChevronIconName" aria-hidden="true" />
{{ __('Toggle thread') }} {{ __('Toggle thread') }}
</button> </button>
</div> </div>
......
...@@ -109,10 +109,6 @@ ...@@ -109,10 +109,6 @@
content: '\f0da'; content: '\f0da';
} }
.fa-chevron-up::before {
content: '\f077';
}
.fa-exclamation-circle::before { .fa-exclamation-circle::before {
content: '\f06a'; content: '\f06a';
} }
......
...@@ -2,17 +2,15 @@ ...@@ -2,17 +2,15 @@
%li.note.note-discussion.timeline-entry.unstyled-comments %li.note.note-discussion.timeline-entry.unstyled-comments
.timeline-entry-inner .timeline-entry-inner
.timeline-content .timeline-content
.discussion.js-toggle-container{ data: { discussion_id: discussion.id } } .discussion.js-toggle-container{ data: { discussion_id: discussion.id, is_expanded: expanded.to_s } }
.discussion-header .discussion-header
.timeline-icon .timeline-icon
= link_to user_path(discussion.author) do = link_to user_path(discussion.author) do
= image_tag avatar_icon_for_user(discussion.author), class: "avatar s40" = image_tag avatar_icon_for_user(discussion.author), class: "avatar s40"
.discussion-actions .discussion-actions
%button.note-action-button.discussion-toggle-button.js-toggle-button{ type: "button", class: ("js-toggle-lazy-diff" unless expanded) } %button.note-action-button.discussion-toggle-button.js-toggle-button{ type: "button", class: ("js-toggle-lazy-diff" unless expanded) }
- if expanded = sprite_icon('chevron-up', css_class: "js-sidebar-collapse #{'hidden' unless expanded}")
= icon("chevron-up") = sprite_icon('chevron-down', css_class: "js-sidebar-expand #{'hidden' if expanded}")
- else
= icon("chevron-down")
= _('Toggle thread') = _('Toggle thread')
= link_to_member(@project, discussion.author, avatar: false) = link_to_member(@project, discussion.author, avatar: false)
......
---
title: Replace fa-chevron-up with GitLab SVG icon
merge_request: 46118
author:
type: changed
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
= f.hidden_field :data, value: license_key = f.hidden_field :data, value: license_key
%a#hide-license.hide-license{ href: '#hide-license' } %a#hide-license.hide-license{ href: '#hide-license' }
Show license key Show license key
= icon('chevron-down') = sprite_icon('chevron-down')
%a#show-license.show-license{ href: '#show-license' } %a#show-license.show-license{ href: '#show-license' }
Hide license key Hide license key
= icon('chevron-up') = sprite_icon('chevron-up')
.card.trial-license-preview.gl-mt-5 .card.trial-license-preview.gl-mt-5
= license_key = license_key
.modal-footer.form-actions .modal-footer.form-actions
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
= s_('Promotions|This feature is locked.') = s_('Promotions|This feature is locked.')
%a.btn-link.js-toggle-button.js-weight-sidebar-callout{ href: '#', data: { track_event: 'click_callout' }.merge(tracking_options) } %a.btn-link.js-toggle-button.js-weight-sidebar-callout{ href: '#', data: { track_event: 'click_callout' }.merge(tracking_options) }
= s_('Promotions|Learn more') = s_('Promotions|Learn more')
= icon('chevron-down') = sprite_icon('chevron-up', css_class: 'js-sidebar-collapse hidden')
= sprite_icon('chevron-down', css_class: 'js-sidebar-expand')
.js-toggle-content{ style:'display: none' } .js-toggle-content{ style:'display: none' }
%div %div
%h4 %h4
......
...@@ -78,7 +78,7 @@ describe('NoteHeader component', () => { ...@@ -78,7 +78,7 @@ describe('NoteHeader component', () => {
expanded: true, expanded: true,
}); });
expect(findChevronIcon().classes()).toContain('fa-chevron-up'); expect(findChevronIcon().props('name')).toBe('chevron-up');
}); });
it('has chevron-down icon if expanded prop is false', () => { it('has chevron-down icon if expanded prop is false', () => {
...@@ -87,7 +87,7 @@ describe('NoteHeader component', () => { ...@@ -87,7 +87,7 @@ describe('NoteHeader component', () => {
expanded: false, expanded: false,
}); });
expect(findChevronIcon().classes()).toContain('fa-chevron-down'); expect(findChevronIcon().props('name')).toBe('chevron-down');
}); });
}); });
......
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