Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebrand icons in buttons and links #587

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ Changelog is rather internal in nature. See release notes for the public overvie

## Version 4.x.x (`release-v4` branch)

- [#587]
- **Description:** Rebrands icons in buttons and links
- **Products impact:** UI
- **Addresses:** -
- **Components:** `KButton`, `KRouterLink`, `KExternalLink`
- **Breaking:** no
- **Impacts a11y:** -
- **Guidance:** -

[#587]: https://github.com/learningequality/kolibri-design-system/pull/587

- [#561]
- **Description:** Update KLogo for new branding guidelines
- **Products impact:** Enables general use of KLogo for all frontend logo usage. Changes props API for square logo presentation.
Expand Down
22 changes: 3 additions & 19 deletions lib/buttons-and-links/KButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,6 @@
};
},
computed: {
iconColor() {
if (this.appearance === 'basic-link') {
return this.hovering ? this.$themeTokens.primaryDark : this.$themeTokens.primary;
}

if (this.secondary) {
return this.appearance === 'raised-button'
? this.$themeBrand.textInverted
: this.$themeBrand.secondary;
} else {
return this.$themeBrand.text;
}
},
htmlTag() {
// Necessary to allow basic links to be rendered as 'inline' instead of
// 'inline-block': https://stackoverflow.com/a/27770128
Expand All @@ -139,12 +126,9 @@
return 'button';
},
arrowStyles() {
if (this.secondary) {
return {
fill: this.$themeBrand.textInverted,
};
}
return {};
return {
fill: this.iconColor,
};
},
textStyle() {
let styles = {};
Expand Down
6 changes: 3 additions & 3 deletions lib/buttons-and-links/KExternalLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
v-if="icon"
:icon="icon"
style="top: 4px;"
:color="hovering ? $themeTokens.primaryDark : $themeTokens.primary"
:color="iconColor"
/>
</slot>

Expand All @@ -33,14 +33,14 @@
v-if="iconAfter"
:icon="iconAfter"
style="top: 4px;"
:color="hovering ? $themeTokens.primaryDark : $themeTokens.primary"
:color="iconColor"
/>
</slot>
<KIcon
v-if="openInNewTab"
icon="openNewTab"
style="top: 4px;"
:color="hovering ? $themeTokens.primaryDark : $themeTokens.primary"
:color="iconColor"
/>
</a>

Expand Down
4 changes: 2 additions & 2 deletions lib/buttons-and-links/KRouterLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
v-if="icon"
:icon="icon"
style="top: 4px;"
:color="hovering ? $themeTokens.primaryDark : $themeTokens.primary"
:color="iconColor"
data-test="icon-before"
/>
</slot>
Expand All @@ -39,7 +39,7 @@
v-if="iconAfter"
:icon="iconAfter"
style="top: 4px;"
:color="hovering ? $themeTokens.secondaryDark : $themeTokens.secondary"
:color="iconColor"
data-test="icon-after"
/>
</slot>
Expand Down
15 changes: 15 additions & 0 deletions lib/buttons-and-links/buttonMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,21 @@ export default {
},
};
},
iconColor() {
if (this.appearance === 'basic-link') {
return this.hovering ? this.$themeTokens.primaryDark : this.$themeTokens.primary;
}

if (this.appearance === 'raised-button') {
return this.primary ? this.$themeTokens.textInverted : this.$themeTokens.text;
}

if (this.appearance === 'flat-button') {
return this.primary ? this.$themeTokens.primary : this.$themeTokens.text;
}

return {};
},
},
methods: {
buttonComputedClass(styles) {
Expand Down