Skip to content

Commit

Permalink
Add filter-link-button mixin (woocommerce#7357)
Browse files Browse the repository at this point in the history
* Set default style to link-button mixin

It was identified that we currently have 3 different behaviors for links used in the application. In issue woocommerce#1778, it was discussed a set of good practices that we should follow in order to obtain consistency between links.

Currently, the link-button mixin is already used by the 'Clear all' button in the Active Filters block, so the idea was to increment it with a common pattern (font size small, font-weight normal, underlined by default and not underlined when on hover) that can be reused by other components (for example FilterResetButton).

* Change link-button mixin to make it attend the expected default style for links

* Replace text-button with link-button mixin in FilterResetButton component

* Add new mixin for links in filter blocks

* Revert change to link-button mixin to prevent it to affect link buttons on Checkout page

* Add filter-link-button mixin that can be used in filter blocks

* Remove link-button styles that were moved to filter-link-button mixin

By default, link-button mixin styles should have only styles from the text-button mixin and also be underlined.

The styles for link button in filter blocks should reside in filter-link-button mixin.
  • Loading branch information
thealexandrelara authored and senadir committed Nov 12, 2022
1 parent 9a2a97a commit bda5b64
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions assets/css/abstracts/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ $fontSizes: (
// Reset <button> style so we can use link style for action buttons.
@mixin link-button() {
@include text-button();
text-decoration: underline;
}

// Reset <button> style so we can use link style for action buttons in filter blocks
@mixin filter-link-button() {
@include link-button();
@include font-size(small);
text-decoration: underline;
font-weight: normal;
Expand Down
2 changes: 1 addition & 1 deletion assets/js/base/components/filter-reset-button/style.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.wc-block-components-filter-reset-button {
@include link-button();
@include filter-link-button();
cursor: pointer;

&[disabled] {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/active-filters/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
overflow: hidden;

.wc-block-active-filters__clear-all {
@include link-button();
@include filter-link-button();
border: none;
margin-top: 15px;
padding: 0;
Expand Down

0 comments on commit bda5b64

Please sign in to comment.