Skip to content

Commit c4b87dc

Browse files
committed
fix pr lint and use placeholders
1 parent 82a4d3e commit c4b87dc

File tree

3 files changed

+90
-55
lines changed

3 files changed

+90
-55
lines changed

packages/styles/src/components/button.scss

+1-51
Original file line numberDiff line numberDiff line change
@@ -22,57 +22,7 @@
2222
tokens.$default-map: components.$post-button;
2323

2424
.btn {
25-
// Resets
26-
display: inline-flex;
27-
position: relative;
28-
align-items: center;
29-
justify-content: center;
30-
max-width: 100%;
31-
overflow: hidden;
32-
transition: button.$btn-transition;
33-
border-width: tokens.get('button-border-width');
34-
border-style: solid;
35-
border-radius: tokens.get('button-border-radius-round');
36-
background-color: transparent;
37-
box-shadow: none;
38-
font-family: inherit;
39-
font-weight: tokens.get('button-label-font-weight');
40-
text-decoration: none;
41-
white-space: nowrap; // Long content should never break in buttons
42-
43-
&:hover {
44-
text-decoration: none;
45-
}
46-
47-
@include button-mx.button-size();
48-
49-
&:disabled {
50-
border-style: tokens.get('button-border-style-disabled');
51-
}
52-
53-
@include utilities.focus-style;
54-
55-
@include utilities.high-contrast-mode() {
56-
&:is(a) {
57-
color: LinkText;
58-
border: unset;
59-
}
60-
61-
&:is(button) {
62-
background-color: ButtonFace !important;
63-
border: 1px solid ButtonBorder !important;
64-
}
65-
66-
&:not(:disabled, .disabled) {
67-
&:is(button):hover {
68-
background-color: Highlight !important;
69-
70-
> post-icon {
71-
color: HighlightText !important;
72-
}
73-
}
74-
}
75-
}
25+
@extend %btn;
7626
}
7727

7828
// Type variants

packages/styles/src/components/target-group.scss

+30-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
@use 'button';
22
@use './../mixins/media';
3+
@use '../functions/tokens';
4+
@use '../tokens/components';
5+
@use './../mixins/button' as button-mx;
6+
@use './../mixins/utilities';
7+
@use './../placeholders/button' as button-ph;
8+
9+
tokens.$default-map: components.$post-button;
310

411
.target-group {
512
gap: 4px;
@@ -12,17 +19,36 @@
1219
}
1320

1421
a {
15-
@extend .btn;
16-
@extend .btn-tertiary;
17-
border: none;
22+
@extend %btn;
23+
border: unset;
1824
font-weight: 400;
1925
padding: 4px 16px;
2026
min-height: 0;
2127
font-size: 1rem;
28+
29+
@include button-mx.button-variant-def('enabled', 'tertiary');
30+
31+
&:disabled {
32+
@include button-mx.button-variant-def('disabled', 'tertiary');
33+
}
34+
35+
@include utilities.not-disabled-hover() {
36+
@include button-mx.button-variant-def('hover', 'tertiary');
37+
}
2238
}
2339

2440
a.active {
25-
@extend .btn-primary;
41+
box-shadow: tokens.get('button-elevation');
42+
43+
@include button-mx.button-variant-def('enabled', 'primary');
44+
45+
&:disabled {
46+
@include button-mx.button-variant-def('disabled', 'primary');
47+
}
48+
49+
@include utilities.not-disabled-hover() {
50+
@include button-mx.button-variant-def('hover', 'primary');
51+
}
2652
}
2753

2854
@include media.max(lg) {

packages/styles/src/placeholders/_button.scss

+59
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
@use './../mixins/color' as color-mx;
33
@use './../variables/color';
44
@use './../variables/components/button';
5+
@use './../mixins/button' as button-mx;
6+
@use '../functions/tokens';
7+
@use '../tokens/components';
8+
9+
tokens.$default-map: components.$post-button;
510

611
%btn-transparent-background {
712
@include utilities.not-disabled-focus-hover() {
@@ -13,3 +18,57 @@
1318
color: color.$black;
1419
}
1520
}
21+
22+
%btn {
23+
// Resets
24+
display: inline-flex;
25+
position: relative;
26+
align-items: center;
27+
justify-content: center;
28+
max-width: 100%;
29+
overflow: hidden;
30+
transition: button.$btn-transition;
31+
border-width: tokens.get('button-border-width');
32+
border-style: solid;
33+
border-radius: tokens.get('button-border-radius-round');
34+
background-color: transparent;
35+
box-shadow: none;
36+
font-family: inherit;
37+
font-weight: tokens.get('button-label-font-weight');
38+
text-decoration: none;
39+
white-space: nowrap; // Long content should never break in buttons
40+
41+
&:hover {
42+
text-decoration: none;
43+
}
44+
45+
@include button-mx.button-size();
46+
47+
&:disabled {
48+
border-style: tokens.get('button-border-style-disabled');
49+
}
50+
51+
@include utilities.focus-style;
52+
53+
@include utilities.high-contrast-mode() {
54+
&:is(a) {
55+
color: LinkText;
56+
border: unset;
57+
}
58+
59+
&:is(button) {
60+
background-color: ButtonFace !important;
61+
border: 1px solid ButtonBorder !important;
62+
}
63+
64+
&:not(:disabled, .disabled) {
65+
&:is(button):hover {
66+
background-color: Highlight !important;
67+
68+
> post-icon {
69+
color: HighlightText !important;
70+
}
71+
}
72+
}
73+
}
74+
}

0 commit comments

Comments
 (0)