Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
cc88db3
Remove external link icon and update docs
sarahill Jul 5, 2022
f87f0e0
Update external link example
sarahill Jul 5, 2022
b12fff3
Merge branch 'main' into external-link-updates
sarahill Jul 6, 2022
881aa50
Merge branch 'main' into external-link-updates
sarahill Jul 8, 2022
84eb318
Merge branch 'main' into external-link-updates
sarahill Jul 15, 2022
725e636
update link guidance
sarahill Jul 15, 2022
2f0e342
update external link
sarahill Jul 15, 2022
e4307d3
Merge branch 'main' into external-link-updates
sarahill Jul 15, 2022
ea62544
Merge branch 'main' into external-link-updates
sarahill Jul 21, 2022
07eb9b9
Version Packages (#6694)
github-actions[bot] Jul 21, 2022
1b35759
Merge branch 'main' into external-link-updates
sarahill Jul 21, 2022
d1374a9
Merge branch 'main' into external-link-updates
sarahill Jul 25, 2022
9162cbd
remove external link icon logic and tests
sarahill Jul 25, 2022
e095872
updating docs and removing external link icon references
sarahill Jul 25, 2022
41e9bbe
Merge branch 'main' into external-link-updates
sarahill Jul 25, 2022
f46765d
remove external icon reference
sarahill Jul 25, 2022
751895a
fix typo
sarahill Jul 26, 2022
72cd19f
Merge branch 'main' into external-link-updates
sarahill Jul 26, 2022
10c6b25
Merge branch 'main' into external-link-updates
sarahill Aug 8, 2022
2266b0f
update link docs
sarahill Aug 8, 2022
4175af6
Create giant-llamas-type.md
sarahill Aug 8, 2022
9622954
Merge branch 'main' into external-link-updates
sarahill Aug 10, 2022
b5a83bf
Update polaris.shopify.com/content/components/link/index.md
sarahill Aug 11, 2022
6e8d50b
Update polaris.shopify.com/content/components/link/index.md
sarahill Aug 11, 2022
c60046f
Update polaris.shopify.com/content/components/link/index.md
sarahill Aug 11, 2022
a6a844f
Update polaris.shopify.com/content/components/link/index.md
sarahill Aug 11, 2022
d1b4f86
Merge branch 'main' into external-link-updates
sarahill Aug 11, 2022
63d7fb9
Merge branch 'external-link-updates' of https://github.com/Shopify/po…
sarahill Aug 11, 2022
36081eb
update dont example image
sarahill Aug 11, 2022
96de7d8
Merge branch 'main' into external-link-updates
sarahill Aug 11, 2022
85775f0
Merge branch 'main' into external-link-updates
sarahill Aug 11, 2022
3b56dd4
Update polaris.shopify.com/content/components/link/index.md
sarahill Aug 11, 2022
b4b40de
Update polaris.shopify.com/content/components/link/index.md
sarahill Aug 11, 2022
05d5608
Update polaris.shopify.com/content/components/link/index.md
sarahill Aug 11, 2022
402b769
Merge branch 'main' into external-link-updates
sarahill Aug 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/giant-llamas-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@shopify/polaris': patch
'polaris.shopify.com': patch
---

Removed external link icon from the Link components external prop and updated Link documentation
1 change: 0 additions & 1 deletion polaris-react/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "zaškrtávací pole",
"undo": "Vrátit zpět",
"cancel": "Zrušit",
"newWindowAccessibilityHint": "(otevře nové okno)",
"clear": "Vymazat",
"close": "Zavřít",
"submit": "Odeslat",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "afkrydsningsfelt",
"undo": "Fortryd",
"cancel": "Annuller",
"newWindowAccessibilityHint": "(åbner et nyt vindue)",
"clear": "Ryd",
"close": "Luk",
"submit": "Send",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "Kontrollkästchen",
"undo": "Rückgängig machen",
"cancel": "Abbrechen",
"newWindowAccessibilityHint": "(öffnet ein neues Fenster)",
"clear": "Löschen",
"close": "Schließen",
"submit": "Senden",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"checkbox": "checkbox",
"undo": "Undo",
"cancel": "Cancel",
"newWindowAccessibilityHint": "(opens a new window)",
"clear": "Clear",
"close": "Close",
"submit": "Submit",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "casilla de verificación",
"undo": "Deshacer",
"cancel": "Cancelar",
"newWindowAccessibilityHint": "(abre una nueva ventana)",
"clear": "Borrar",
"close": "Cerrar",
"submit": "Enviar",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "valintaruutu",
"undo": "Peru",
"cancel": "Peruuta",
"newWindowAccessibilityHint": "(avaa uuden ikkunan)",
"clear": "Tyhjennä",
"close": "Sulje",
"submit": "Lähetä",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "case à cocher",
"undo": "Annuler",
"cancel": "Annuler",
"newWindowAccessibilityHint": "(ouvre une nouvelle fenêtre)",
"clear": "Effacer",
"close": "Fermer",
"submit": "Soumettre",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "casella di spunta",
"undo": "Annulla",
"cancel": "Annulla",
"newWindowAccessibilityHint": "(apre una nuova finestra)",
"clear": "Rimuovi",
"close": "Chiudi",
"submit": "Invia",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "チェックボックス",
"undo": "元に戻す",
"cancel": "キャンセル",
"newWindowAccessibilityHint": "(新しいウィンドウを開く)",
"clear": "クリア",
"close": "閉じる",
"submit": "送信",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "확인란",
"undo": "실행 취소",
"cancel": "취소",
"newWindowAccessibilityHint": "(새 창에서 열림)",
"clear": "지우기",
"close": "닫기",
"submit": "제출",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/nb.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "avmerkingsboks",
"undo": "Angre",
"cancel": "Avbryt",
"newWindowAccessibilityHint": "(åpner et nytt vindu)",
"clear": "Fjern",
"close": "Lukk",
"submit": "Send inn",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "selectievakje",
"undo": "Ongedaan maken",
"cancel": "Annuleren",
"newWindowAccessibilityHint": "(opent een nieuw venster)",
"clear": "Wissen",
"close": "Sluiten",
"submit": "Indienen",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "pole wyboru",
"undo": "Cofnij",
"cancel": "Anuluj",
"newWindowAccessibilityHint": "(otwiera nowe okno)",
"clear": "Wyczyść",
"close": "Zamknij",
"submit": "Prześlij",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "caixa de seleção",
"undo": "Desfazer",
"cancel": "Cancelar",
"newWindowAccessibilityHint": "(abre uma nova janela)",
"clear": "Limpar",
"close": "Fechar",
"submit": "Enviar",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "caixa de verificação",
"undo": "Anular",
"cancel": "Cancelar",
"newWindowAccessibilityHint": "(abre uma nova janela)",
"clear": "Limpar",
"close": "Fechar",
"submit": "Submeter",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "kryssruta",
"undo": "Ångra",
"cancel": "Avbryt",
"newWindowAccessibilityHint": "(öppnar ett nytt fönster)",
"clear": "Rensa",
"close": "Stäng",
"submit": "Skicka",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "ช่องทำเครื่องหมาย",
"undo": "เลิกทำ",
"cancel": "ยกเลิก",
"newWindowAccessibilityHint": "(เปิดหน้าต่างใหม่)",
"clear": "ล้าง",
"close": "ปิด",
"submit": "ส่ง",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "onay kutusu",
"undo": "Geri al",
"cancel": "İptal et",
"newWindowAccessibilityHint": "(yeni bir pencere açar)",
"clear": "Temizle",
"close": "Kapat",
"submit": "Gönder",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "hộp kiểm",
"undo": "Hoàn tác",
"cancel": "Hủy",
"newWindowAccessibilityHint": "(mở một cửa sổ mới)",
"clear": "Xóa",
"close": "Đóng",
"submit": "Gửi",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "复选框",
"undo": "撤销",
"cancel": "取消",
"newWindowAccessibilityHint": "(打开新窗口)",
"clear": "清除",
"close": "关闭",
"submit": "提交",
Expand Down
1 change: 0 additions & 1 deletion polaris-react/locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"checkbox": "核取方塊",
"undo": "復原",
"cancel": "取消",
"newWindowAccessibilityHint": "(開啟新視窗)",
"clear": "清除",
"close": "關閉",
"submit": "提交",
Expand Down
18 changes: 0 additions & 18 deletions polaris-react/src/components/Link/Link.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,6 @@
}
}

.IconLockup {
@include recolor-icon(currentColor);
display: inline;
white-space: nowrap;

&::before {
content: '\2060';
}
}

.IconLayout {
display: inline-flex;

&::before {
content: '\2060';
}
}

.monochrome {
color: inherit;

Expand Down
27 changes: 2 additions & 25 deletions polaris-react/src/components/Link/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from 'react';
import {ExternalSmallMinor} from '@shopify/polaris-icons';

import {BannerContext} from '../../utilities/banner-context';
import {classNames} from '../../utilities/css';
import {useI18n} from '../../utilities/i18n';
import {UnstyledLink} from '../UnstyledLink';
import {Icon} from '../Icon';

import styles from './Link.scss';

Expand Down Expand Up @@ -41,26 +38,6 @@ export function Link({
accessibilityLabel,
dataPrimaryLink,
}: LinkProps) {
const i18n = useI18n();
let childrenMarkup = children;

if (external && typeof children === 'string') {
const iconLabel = i18n.translate(
'Polaris.Common.newWindowAccessibilityHint',
);

childrenMarkup = (
<>
{children}
<span className={styles.IconLockup}>
<span className={styles.IconLayout}>
<Icon accessibilityLabel={iconLabel} source={ExternalSmallMinor} />
</span>
</span>
</>
);
}

return (
<BannerContext.Consumer>
{(BannerContext) => {
Expand All @@ -82,7 +59,7 @@ export function Link({
aria-label={accessibilityLabel}
data-primary-link={dataPrimaryLink}
>
{childrenMarkup}
{children}
</UnstyledLink>
) : (
<button
Expand All @@ -93,7 +70,7 @@ export function Link({
aria-label={accessibilityLabel}
data-primary-link={dataPrimaryLink}
>
{childrenMarkup}
{children}
</button>
);
}}
Expand Down
29 changes: 4 additions & 25 deletions polaris-react/src/components/Link/tests/Link.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import {mountWithApp} from 'tests/utilities';

import {Banner} from '../../Banner';
import {UnstyledLink} from '../../UnstyledLink';
import {Icon} from '../../Icon';
import en from '../../../../locales/en.json';
import {Link} from '../Link';

describe('<Link />', () => {
Expand Down Expand Up @@ -40,35 +38,16 @@ describe('<Link />', () => {
});

describe('external link', () => {
it('has a trailing icon', () => {
it('adds target blank and noopener noreferrer if external', () => {
const link = mountWithApp(
<Link url="https://help.shopify.com/" external>
Shopify Help Center
</Link>,
);
expect(link).toContainReactComponent(Icon);
});

it('informs screen readers that it opens in a new window', () => {
const link = mountWithApp(
<Link url="https://help.shopify.com/" external>
Shopify Help Center
</Link>,
);
const hintText = en.Polaris.Common.newWindowAccessibilityHint;
const htmlLink = link.find('a');

expect(link).toContainReactComponent(Icon, {
accessibilityLabel: hintText,
});
});

it('doesn’t have a trailing icon for non-string children', () => {
const link = mountWithApp(
<Link url="https://help.shopify.com/" external>
<span>Shopify Help Center</span>
</Link>,
);
expect(link).not.toContainReactComponent(Icon);
expect(htmlLink?.props.target).toBe('_blank');
expect(htmlLink?.props.rel).toBe('noopener noreferrer');
});
});

Expand Down
16 changes: 0 additions & 16 deletions polaris-react/src/components/Navigation/components/Item/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import React, {
ReactNode,
useCallback,
} from 'react';
import {ExternalMinor} from '@shopify/polaris-icons';

import {classNames} from '../../../../utilities/css';
import {NavigationContext} from '../../context';
Expand Down Expand Up @@ -142,20 +141,6 @@ export function Item({
</div>
) : null;

const externalIconLabel = i18n.translate(
'Polaris.Common.newWindowAccessibilityHint',
);

const externalLinkIconMarkup = external ? (
<div className={styles.ExternalIcon}>
<Icon
accessibilityLabel={externalIconLabel}
source={ExternalMinor}
color="base"
/>
</div>
) : null;

let badgeMarkup: ReactNode = null;
if (isNew) {
badgeMarkup = (
Expand Down Expand Up @@ -343,7 +328,6 @@ export function Item({
)}
>
{itemContentMarkup}
{externalLinkIconMarkup}
</UnstyledLink>
{secondaryActionMarkup}
</div>
Expand Down
Loading