-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: switch back link to use link icon (#156)
- Loading branch information
Showing
43 changed files
with
43 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,39 @@ | ||
import './d2l-navigation-link.js'; | ||
import '@brightspace-ui/core/components/icons/icon.js'; | ||
import '@brightspace-ui/polymer-behaviors/d2l-focusable-behavior.js'; | ||
import '@brightspace-ui/localize-behavior/d2l-localize-behavior.js'; | ||
import './d2l-navigation-link-icon.js'; | ||
import { css, html, LitElement } from 'lit'; | ||
import { FocusMixin } from '@brightspace-ui/core/mixins/focus-mixin.js'; | ||
import { LocalizeNavigationElement } from './components/localize-navigation-element.js'; | ||
|
||
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js'; | ||
import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js'; | ||
/** | ||
`d2l-navigation-link-back` | ||
Polymer-based web component for the back button used in the navigational header. | ||
@demo demo/d2l-navigation-button.html d2l-navigation-link-back | ||
*/ | ||
class D2LNavigationLinkBack extends mixinBehaviors([D2L.PolymerBehaviors.FocusableBehavior, | ||
D2L.PolymerBehaviors.LocalizeBehavior], PolymerElement) { | ||
class NavigationLinkBack extends LocalizeNavigationElement(FocusMixin(LitElement)) { | ||
|
||
static get properties() { | ||
return { | ||
text: { | ||
type: String, | ||
value: null | ||
}, | ||
href: { | ||
type: String | ||
}, | ||
resources: { | ||
value: function() { | ||
return { | ||
'ar': { 'back': 'العودة' }, | ||
'de': { 'back': 'Zurück' }, | ||
'en': { 'back': 'Back' }, | ||
'es': { 'back': 'Volver' }, | ||
'fr': { 'back': 'Précédent' }, | ||
'ja': { 'back': '戻る' }, | ||
'ko': { 'back': '뒤로' }, | ||
'nl': { 'back': 'Terug' }, | ||
'pt': { 'back': 'Voltar' }, | ||
'sv': { 'back': 'Tillbaka' }, | ||
'tr': { 'back': 'Geri' }, | ||
'zh': { 'back': '返回' }, | ||
'zh-TW': { 'back': '返回' } | ||
}; | ||
} | ||
} | ||
text: { type: String }, | ||
href: { type: String } | ||
}; | ||
} | ||
static get template() { | ||
const template = html` | ||
<style> | ||
|
||
static get styles() { | ||
return css` | ||
:host { | ||
display: inline-block; | ||
height: 100%; | ||
white-space: nowrap; | ||
} | ||
d2l-icon { | ||
color: inherit; | ||
} | ||
.d2l-navigation-link-back-text { | ||
padding-left: var(--d2l-navigation-link-back-left-padding, 5px); | ||
} | ||
:host(:dir(rtl)) .d2l-navigation-link-back-text { | ||
padding-left: 0; | ||
padding-right: var(--d2l-navigation-link-back-left-padding, 5px); | ||
:host([hidden]) { | ||
display: none; | ||
} | ||
</style> | ||
<d2l-navigation-link href="[[href]]" class="d2l-focusable" text="[[_getDisplayText(text, localize)]]"> | ||
<d2l-icon icon="tier1:chevron-left"></d2l-icon> | ||
<span class="d2l-navigation-link-back-text">[[_getDisplayText(text, localize)]]</span> | ||
</d2l-navigation-link> | ||
`; | ||
template.setAttribute('strip-whitespace', ''); | ||
return template; | ||
} | ||
|
||
_getDisplayText(text, localize) { | ||
if (text === undefined || text === null) { | ||
return localize('back'); | ||
} | ||
return text; | ||
static get focusElementSelector() { | ||
return 'd2l-navigation-link-icon'; | ||
} | ||
|
||
render() { | ||
const href = this.href ? this.href : 'javascript:void(0);'; // backwards-compatible for uses before missing "href" threw exception | ||
const text = this.text ? this.text : this.localize('back'); | ||
return html`<d2l-navigation-link-icon href="${href}" icon="tier1:chevron-left" text="${text}"></d2l-navigation-link-icon>`; | ||
} | ||
|
||
} | ||
customElements.define('d2l-navigation-link-back', D2LNavigationLinkBack); | ||
|
||
customElements.define('d2l-navigation-link-back', NavigationLinkBack); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "العودة", | ||
"next": "التالي", | ||
"previous": "السابق" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "Back", | ||
"next": "Next", | ||
"previous": "Previous" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "Back", | ||
"next": "Next", | ||
"previous": "Previous" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "Zurück", | ||
"next": "Next", | ||
"previous": "Previous" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "Back", | ||
"next": "Next", | ||
"previous": "Previous" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "Volver", | ||
"next": "Siguiente", | ||
"previous": "Anterior" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "Volver", | ||
"next": "Siguiente", | ||
"previous": "Anterior" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "Précédent", | ||
"next": "Suivant", | ||
"previous": "Précédent" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "Précédent", | ||
"next": "Suivant", | ||
"previous": "Précédent" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "Back", | ||
"next": "Next", | ||
"previous": "Previous" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "戻る", | ||
"next": "Next", | ||
"previous": "Previous" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "뒤로", | ||
"next": "다음", | ||
"previous": "이전" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "Terug", | ||
"next": "Next", | ||
"previous": "Previous" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "Voltar", | ||
"next": "Próximo", | ||
"previous": "Anterior" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "Tillbaka", | ||
"next": "Nästa", | ||
"previous": "Föregående" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "Geri", | ||
"next": "Sonraki", | ||
"previous": "Önceki" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "返回", | ||
"next": "下一页", | ||
"previous": "上一个" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint quotes: 0 */ | ||
|
||
export default { | ||
"back": "返回", | ||
"next": "下一個", | ||
"previous": "上一個" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+5 Bytes
(100%)
...ci/golden/d2l-navigation-immersive/d2l-navigation-immersive-both-slots-1500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+23 Bytes
(100%)
.../ci/golden/d2l-navigation-immersive/d2l-navigation-immersive-both-slots-767.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+24 Bytes
(100%)
.../ci/golden/d2l-navigation-immersive/d2l-navigation-immersive-both-slots-929.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-7 Bytes
(100%)
.../golden/d2l-navigation-immersive/d2l-navigation-immersive-focus-back-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+11 Bytes
(100%)
...ci/golden/d2l-navigation-immersive/d2l-navigation-immersive-fullscreen-1500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+21 Bytes
(100%)
.../ci/golden/d2l-navigation-immersive/d2l-navigation-immersive-fullscreen-767.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+19 Bytes
(100%)
.../ci/golden/d2l-navigation-immersive/d2l-navigation-immersive-fullscreen-929.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+14 Bytes
(100%)
...i/golden/d2l-navigation-immersive/d2l-navigation-immersive-new-slots-middle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+15 Bytes
(100%)
...ci/golden/d2l-navigation-immersive/d2l-navigation-immersive-new-slots-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+11 Bytes
(100%)
...olden/d2l-navigation-immersive/d2l-navigation-immersive-no-middle-slot-1500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+18 Bytes
(100%)
...golden/d2l-navigation-immersive/d2l-navigation-immersive-no-middle-slot-767.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+21 Bytes
(100%)
...golden/d2l-navigation-immersive/d2l-navigation-immersive-no-middle-slot-929.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+37 Bytes
(100%)
...golden/d2l-navigation-immersive/d2l-navigation-immersive-no-right-slot-1500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+41 Bytes
(100%)
.../golden/d2l-navigation-immersive/d2l-navigation-immersive-no-right-slot-767.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+40 Bytes
(100%)
.../golden/d2l-navigation-immersive/d2l-navigation-immersive-no-right-slot-929.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+6 Bytes
(100%)
...ots/ci/golden/d2l-navigation-immersive/d2l-navigation-immersive-normal-1500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+21 Bytes
(100%)
...hots/ci/golden/d2l-navigation-immersive/d2l-navigation-immersive-normal-767.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+19 Bytes
(100%)
...hots/ci/golden/d2l-navigation-immersive/d2l-navigation-immersive-normal-929.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+15 Bytes
(100%)
test/screenshots/ci/golden/d2l-navigation-link/d2l-navigation-link-back-focus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+15 Bytes
(100%)
test/screenshots/ci/golden/d2l-navigation-link/d2l-navigation-link-back-hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7 Bytes
(100%)
test/screenshots/ci/golden/d2l-navigation-link/d2l-navigation-link-back-normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.