-
Notifications
You must be signed in to change notification settings - Fork 4k
/
style.scss
158 lines (134 loc) · 4.22 KB
/
style.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// This variable is repeated across Button, Buttons, and Buttons editor styles.
$blocks-block__margin: 0.5em;
// Prefer the link selector instead of the regular button classname
// to support the previous markup in addition to the new one.
.wp-block-button__link {
cursor: pointer;
display: inline-block;
text-align: center;
word-break: break-word; // overflow-wrap doesn't work well if a link is wrapped in the div, so use word-break here.
box-sizing: border-box;
&.aligncenter {
text-align: center;
}
&.alignright {
/*rtl:ignore*/
text-align: right;
}
}
// These rules are set to zero specificity to keep the default styles for buttons.
// They are needed for backwards compatibility.
:where(.wp-block-button__link) {
// This needs a low specificity so it won't override the rules from the button element if defined in theme.json.
box-shadow: none;
text-decoration: none;
// 100% causes an oval, but any explicit but really high value retains the pill shape.
border-radius: 9999px;
// The extra 2px are added to size solids the same as the outline versions.
padding: calc(0.667em + 2px) calc(1.333em + 2px);
}
.wp-block-button[style*="text-transform"] .wp-block-button__link {
text-transform: inherit;
}
.wp-block-button[style*="text-decoration"] .wp-block-button__link {
text-decoration: inherit;
}
// Increased specificity needed to override margins.
.wp-block-buttons > .wp-block-button {
&.has-custom-width {
max-width: none;
.wp-block-button__link {
width: 100%;
}
}
&.has-custom-font-size {
.wp-block-button__link {
font-size: inherit;
}
}
&.wp-block-button__width-25 {
width: calc(25% - (var(--wp--style--block-gap, #{$blocks-block__margin}) * 0.75));
}
&.wp-block-button__width-50 {
width: calc(50% - (var(--wp--style--block-gap, #{$blocks-block__margin}) * 0.5));
}
&.wp-block-button__width-75 {
width: calc(75% - (var(--wp--style--block-gap, #{$blocks-block__margin}) * 0.25));
}
&.wp-block-button__width-100 {
width: 100%;
flex-basis: 100%;
}
}
// For vertical buttons, gap is not factored into width calculations.
.wp-block-buttons.is-vertical > .wp-block-button {
&.wp-block-button__width-25 {
width: 25%;
}
&.wp-block-button__width-50 {
width: 50%;
}
&.wp-block-button__width-75 {
width: 75%;
}
}
// the first selector is required for old buttons markup
.wp-block-button.is-style-squared,
.wp-block-button__link.wp-block-button.is-style-squared {
border-radius: 0;
}
// the first selector is required for old buttons markup
.wp-block-button.no-border-radius,
.wp-block-button__link.no-border-radius {
border-radius: 0 !important;
}
.wp-block-button:where(.is-style-outline) > .wp-block-button__link,
.wp-block-button .wp-block-button__link:where(.is-style-outline) {
border: 2px solid currentColor;
padding: 0.667em 1.333em;
}
.wp-block-button:where(.is-style-outline) > .wp-block-button__link:not(.has-text-color),
.wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-text-color) {
color: currentColor;
}
.wp-block-button:where(.is-style-outline) > .wp-block-button__link:not(.has-background),
.wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-background) {
background-color: transparent;
// background-image is required to overwrite a gradient background
background-image: none;
}
.wp-block-button .wp-block-button__link {
// The following styles ensure a default border is applied when the user
// selects only a border color or style. This overcomes the zero border
// width applied by core's theme.json via the elements API.
&:where(.has-border-color) {
border-width: initial;
}
&:where([style*="border-top-color"]) {
border-top-width: initial;
}
&:where([style*="border-right-color"]) {
border-right-width: initial;
}
&:where([style*="border-bottom-color"]) {
border-bottom-width: initial;
}
&:where([style*="border-left-color"]) {
border-left-width: initial;
}
&:where([style*="border-style"]) {
border-width: initial;
}
&:where([style*="border-top-style"]) {
border-top-width: initial;
}
&:where([style*="border-right-style"]) {
border-right-width: initial;
}
&:where([style*="border-bottom-style"]) {
border-bottom-width: initial;
}
&:where([style*="border-left-style"]) {
border-left-width: initial;
}
}