Commit 3b71bda3 authored by Justin Ho's avatar Justin Ho

Replace external-link icons with GitLab SVG

In Vue/JS
parent 86a4b009
<script> <script>
import { mapState, mapGetters, mapActions } from 'vuex'; import { mapState, mapGetters, mapActions } from 'vuex';
import { GlSprintf, GlLink } from '@gitlab/ui'; import { GlSprintf, GlLink, GlIcon } from '@gitlab/ui';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import gkeDropdownMixin from './gke_dropdown_mixin'; import gkeDropdownMixin from './gke_dropdown_mixin';
...@@ -10,6 +10,7 @@ export default { ...@@ -10,6 +10,7 @@ export default {
components: { components: {
GlSprintf, GlSprintf,
GlLink, GlLink,
GlIcon,
}, },
mixins: [gkeDropdownMixin], mixins: [gkeDropdownMixin],
props: { props: {
...@@ -178,14 +179,14 @@ export default { ...@@ -178,14 +179,14 @@ export default {
'https://console.cloud.google.com/freetrial?utm_campaign=2018_cpanel&utm_source=gitlab&utm_medium=referral' 'https://console.cloud.google.com/freetrial?utm_campaign=2018_cpanel&utm_source=gitlab&utm_medium=referral'
" "
target="_blank" target="_blank"
>{{ content }} <i class="fa fa-external-link" aria-hidden="true"></i >{{ content }} <gl-icon name="external-link" aria-hidden="true"
></gl-link> /></gl-link>
</template> </template>
<template #docsLink="{ content }"> <template #docsLink="{ content }">
<gl-link :href="docsUrl" target="_blank" <gl-link :href="docsUrl" target="_blank"
>{{ content }} <i class="fa fa-external-link" aria-hidden="true"></i >{{ content }} <gl-icon name="external-link" aria-hidden="true"
></gl-link> /></gl-link>
</template> </template>
<template #error> <template #error>
......
import { LOADING, ERROR, SUCCESS } from '../../constants'; import { LOADING, ERROR, SUCCESS } from '../../constants';
import { sprintf, __, s__, n__ } from '~/locale'; import { sprintf, __, s__, n__ } from '~/locale';
import { spriteIcon } from '~/lib/utils/common_utils';
export const hasCodequalityIssues = state => export const hasCodequalityIssues = state =>
Boolean(state.newIssues?.length || state.resolvedIssues?.length); Boolean(state.newIssues?.length || state.resolvedIssues?.length);
...@@ -48,7 +49,7 @@ export const codequalityPopover = state => { ...@@ -48,7 +49,7 @@ export const codequalityPopover = state => {
s__('ciReport|%{linkStartTag}Learn more about codequality reports %{linkEndTag}'), s__('ciReport|%{linkStartTag}Learn more about codequality reports %{linkEndTag}'),
{ {
linkStartTag: `<a href="${state.helpPath}" target="_blank" rel="noopener noreferrer">`, linkStartTag: `<a href="${state.helpPath}" target="_blank" rel="noopener noreferrer">`,
linkEndTag: '<i class="fa fa-external-link" aria-hidden="true"></i></a>', linkEndTag: `${spriteIcon('external-link', 's16')}</a>`,
}, },
false, false,
), ),
......
import { sprintf, s__ } from '~/locale'; import { sprintf, s__ } from '~/locale';
import { spriteIcon } from '~/lib/utils/common_utils';
// Securely open external links in a new tab. // Securely open external links in a new tab.
function getLinkStartTag(url) { function getLinkStartTag(url) {
...@@ -6,7 +7,7 @@ function getLinkStartTag(url) { ...@@ -6,7 +7,7 @@ function getLinkStartTag(url) {
} }
// Add in the external link icon at the end of every link. // Add in the external link icon at the end of every link.
const linkEndTag = '<i class="fa fa-external-link" aria-hidden="true"></i></a>'; const linkEndTag = `${spriteIcon('external-link', 's16')}</a>`;
export default { export default {
computed: { computed: {
......
...@@ -26,6 +26,6 @@ describe('securityReportMixin', () => { ...@@ -26,6 +26,6 @@ describe('securityReportMixin', () => {
expect(mixinLink).toContain(`href="${link}`); expect(mixinLink).toContain(`href="${link}`);
expect(mixinLink).toContain('target="_blank"'); expect(mixinLink).toContain('target="_blank"');
expect(mixinLink).toContain('rel="noopener noreferrer"'); expect(mixinLink).toContain('rel="noopener noreferrer"');
expect(mixinLink).toContain('<i class="fa fa-external-link" aria-hidden="true"></i>'); expect(mixinLink).toContain('external-link');
}); });
}); });
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