Skip to content

Commit

Permalink
Merge pull request #587 from MisRob/rebrand-icon-buttons
Browse files Browse the repository at this point in the history
Rebrand icons in buttons and links
  • Loading branch information
rtibbles authored Mar 28, 2024
2 parents 9dcacd9 + 2ceafdd commit a0e7c40
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 24 deletions.
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

0 comments on commit a0e7c40

Please sign in to comment.