Commit 4ee28e9d authored by Phil Hughes's avatar Phil Hughes

Merge branch...

Merge branch '267973-replace-fa-angle-double-left-with-gitlab-svg-chevron-double-lg-left-icon' into 'master'

Replace fa-angle-double-[left|right] with GitLab SVG icons

See merge request gitlab-org/gitlab!45251
parents 9af861aa 9bc0a88e
...@@ -285,10 +285,9 @@ export default { ...@@ -285,10 +285,9 @@ export default {
variant="default" variant="default"
class="d-sm-none gl-absolute toggle-sidebar-mobile-button" class="d-sm-none gl-absolute toggle-sidebar-mobile-button"
type="button" type="button"
icon="chevron-double-lg-left"
@click="toggleSidebar" @click="toggleSidebar"
> />
<i class="fa fa-angle-double-left"></i>
</gl-button>
</div> </div>
<div <div
v-if="alert" v-if="alert"
......
...@@ -32,11 +32,12 @@ export default () => { ...@@ -32,11 +32,12 @@ export default () => {
// Sidebar has an icon which corresponds to collapsing the sidebar // Sidebar has an icon which corresponds to collapsing the sidebar
// only then trigger the click. // only then trigger the click.
if (
sidebarGutterVueToggleEl &&
!sidebarGutterVueToggleEl.classList.contains('js-sidebar-collapsed')
) {
if (sidebarGutterVueToggleEl) { if (sidebarGutterVueToggleEl) {
const collapseIcon = sidebarGutterVueToggleEl.querySelector('i.fa-angle-double-right'); sidebarGutterVueToggleEl.click();
if (collapseIcon) {
collapseIcon.click();
} }
} }
} }
......
...@@ -478,13 +478,14 @@ export default class MergeRequestTabs { ...@@ -478,13 +478,14 @@ export default class MergeRequestTabs {
} }
shrinkView() { shrinkView() {
const $gutterIcon = $('.js-sidebar-toggle i:visible'); const $gutterBtn = $('.js-sidebar-toggle:visible');
const $expandSvg = $gutterBtn.find('.js-sidebar-expand');
// Wait until listeners are set // Wait until listeners are set
setTimeout(() => { setTimeout(() => {
// Only when sidebar is expanded // Only when sidebar is expanded
if ($gutterIcon.is('.fa-angle-double-right')) { if ($expandSvg.length && $expandSvg.hasClass('hidden')) {
$gutterIcon.closest('a').trigger('click', [true]); $gutterBtn.trigger('click', [true]);
} }
}, 0); }, 0);
} }
...@@ -494,13 +495,14 @@ export default class MergeRequestTabs { ...@@ -494,13 +495,14 @@ export default class MergeRequestTabs {
if (parseBoolean(Cookies.get('collapsed_gutter'))) { if (parseBoolean(Cookies.get('collapsed_gutter'))) {
return; return;
} }
const $gutterIcon = $('.js-sidebar-toggle i:visible'); const $gutterBtn = $('.js-sidebar-toggle');
const $collapseSvg = $gutterBtn.find('.js-sidebar-collapse');
// Wait until listeners are set // Wait until listeners are set
setTimeout(() => { setTimeout(() => {
// Only when sidebar is collapsed // Only when sidebar is collapsed
if ($gutterIcon.is('.fa-angle-double-left')) { if ($collapseSvg.length && !$collapseSvg.hasClass('hidden')) {
$gutterIcon.closest('a').trigger('click', [true]); $gutterBtn.trigger('click', [true]);
} }
}, 0); }, 0);
} }
......
<script> <script>
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon, GlIcon } from '@gitlab/ui';
import { n__, __ } from '~/locale'; import { n__, __ } from '~/locale';
export default { export default {
name: 'AssigneeTitle', name: 'AssigneeTitle',
components: { components: {
GlLoadingIcon, GlLoadingIcon,
GlIcon,
}, },
props: { props: {
loading: { loading: {
...@@ -64,7 +65,7 @@ export default { ...@@ -64,7 +65,7 @@ export default {
href="#" href="#"
role="button" role="button"
> >
<i aria-hidden="true" data-hidden="true" class="fa fa-angle-double-right"></i> <gl-icon aria-hidden="true" data-hidden="true" name="chevron-double-lg-right" :size="12" />
</a> </a>
</div> </div>
</template> </template>
<script> <script>
// NOTE! For the first iteration, we are simply copying the implementation of Assignees // NOTE! For the first iteration, we are simply copying the implementation of Assignees
// It will soon be overhauled in Issue https://gitlab.com/gitlab-org/gitlab/-/issues/233736 // It will soon be overhauled in Issue https://gitlab.com/gitlab-org/gitlab/-/issues/233736
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon, GlIcon } from '@gitlab/ui';
import { n__ } from '~/locale'; import { n__ } from '~/locale';
export default { export default {
name: 'ReviewerTitle', name: 'ReviewerTitle',
components: { components: {
GlLoadingIcon, GlLoadingIcon,
GlIcon,
}, },
props: { props: {
loading: { loading: {
...@@ -58,7 +59,7 @@ export default { ...@@ -58,7 +59,7 @@ export default {
href="#" href="#"
role="button" role="button"
> >
<i aria-hidden="true" data-hidden="true" class="fa fa-angle-double-right"></i> <gl-icon aria-hidden="true" data-hidden="true" name="chevron-double-lg-right" :size="12" />
</a> </a>
</div> </div>
</template> </template>
<script> <script>
import { GlButton, GlTooltipDirective } from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
import tooltip from '~/vue_shared/directives/tooltip';
export default { export default {
name: 'ToggleSidebar', name: 'ToggleSidebar',
components: {
GlButton,
},
directives: { directives: {
tooltip, GlTooltip: GlTooltipDirective,
}, },
props: { props: {
collapsed: { collapsed: {
...@@ -22,6 +25,12 @@ export default { ...@@ -22,6 +25,12 @@ export default {
tooltipLabel() { tooltipLabel() {
return this.collapsed ? __('Expand sidebar') : __('Collapse sidebar'); return this.collapsed ? __('Expand sidebar') : __('Collapse sidebar');
}, },
buttonIcon() {
return this.collapsed ? 'chevron-double-lg-left' : 'chevron-double-lg-right';
},
allCssClasses() {
return [this.cssClasses, { 'js-sidebar-collapsed': this.collapsed }];
},
}, },
methods: { methods: {
toggle() { toggle() {
...@@ -32,25 +41,15 @@ export default { ...@@ -32,25 +41,15 @@ export default {
</script> </script>
<template> <template>
<button <gl-button
v-tooltip v-gl-tooltip:body.viewport.left
:title="tooltipLabel" :title="tooltipLabel"
:class="cssClasses" :class="allCssClasses"
type="button" class="gutter-toggle btn-sidebar-action js-sidebar-vue-toggle"
class="btn btn-blank gutter-toggle btn-sidebar-action js-sidebar-vue-toggle" :icon="buttonIcon"
data-container="body" category="tertiary"
data-placement="left" size="small"
data-boundary="viewport"
@click="toggle"
>
<i
:class="{
'fa-angle-double-right': !collapsed,
'fa-angle-double-left': collapsed,
}"
:aria-label="__('toggle collapse')" :aria-label="__('toggle collapse')"
class="fa" @click="toggle"
> />
</i>
</button>
</template> </template>
...@@ -109,14 +109,6 @@ ...@@ -109,14 +109,6 @@
content: '\f110'; content: '\f110';
} }
.fa-angle-double-right::before {
content: '\f101';
}
.fa-angle-double-left::before {
content: '\f100';
}
.fa-trash-o::before { .fa-trash-o::before {
content: '\f014'; content: '\f014';
} }
......
---
title: Replace fa-angle-double-left and fa-angle-double-right icons with GitLab SVG
merge_request: 45251
author:
type: changed
...@@ -114,10 +114,9 @@ export default { ...@@ -114,10 +114,9 @@ export default {
type="button" type="button"
class="float-right gl-display-block d-sm-none gl-align-self-center gutter-toggle issuable-gutter-toggle" class="float-right gl-display-block d-sm-none gl-align-self-center gutter-toggle issuable-gutter-toggle"
data-testid="sidebar-toggle" data-testid="sidebar-toggle"
icon="chevron-double-lg-left"
@click="toggleSidebar({ sidebarCollapsed })" @click="toggleSidebar({ sidebarCollapsed })"
> />
<i class="fa fa-angle-double-left"></i>
</gl-button>
<div <div
class="detail-page-header-actions gl-display-flex gl-flex-wrap gl-align-items-center gl-w-full gl-sm-w-auto!" class="detail-page-header-actions gl-display-flex gl-flex-wrap gl-align-items-center gl-w-full gl-sm-w-auto!"
data-testid="action-buttons" data-testid="action-buttons"
......
...@@ -11,15 +11,14 @@ describe('toggleSidebar', () => { ...@@ -11,15 +11,14 @@ describe('toggleSidebar', () => {
}); });
}); });
it('should render << when collapsed', () => { it('should render the "chevron-double-lg-left" icon when collapsed', () => {
expect(vm.$el.querySelector('.fa').classList.contains('fa-angle-double-left')).toEqual(true); expect(vm.$el.querySelector('[data-testid="chevron-double-lg-left-icon"]')).not.toBeNull();
}); });
it('should render >> when collapsed', () => { it('should render the "chevron-double-lg-right" icon when expanded', async () => {
vm.collapsed = false; vm.collapsed = false;
Vue.nextTick(() => { await Vue.nextTick();
expect(vm.$el.querySelector('.fa').classList.contains('fa-angle-double-right')).toEqual(true); expect(vm.$el.querySelector('[data-testid="chevron-double-lg-right-icon"]')).not.toBeNull();
});
}); });
it('should emit toggle event when button clicked', () => { it('should emit toggle event when button clicked', () => {
......
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