Skip to content

Commit f585d8a

Browse files
committed
use postcss extend instead of soon to be deprecated apply
1 parent 2c8629c commit f585d8a

File tree

7 files changed

+51
-55
lines changed

7 files changed

+51
-55
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
"postcss": "^6.0.13",
110110
"postcss-cli": "^4.1.1",
111111
"postcss-cssnext": "^3.0.2",
112+
"postcss-extend": "^1.0.5",
112113
"postcss-import": "^10.0.0",
113114
"postcss-url": "^7.1.2",
114115
"rimraf": "^2.6.2",

postcss.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ let conf = {
66
plugins: [
77
require('postcss-import')(),
88
require('postcss-url')({ url: 'inline', maxSize: Number.MAX_SAFE_INTEGER }),
9+
require('postcss-extend')(),
910
require('postcss-cssnext')({
1011
browsers: require('./package.json').browserslist,
1112
warnForDuplicates: false

src/styles/features/view/editWarning.css

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
/* change someday to global "snackbar" component, like in react material-ui */
44
.edit-warning-container {
5-
@apply --flex-center;
6-
@apply --no-select;
5+
@extend %flex-center;
6+
@extend %no-select;
77

88
position: fixed;
99
pointer-events: none;
@@ -25,7 +25,7 @@
2525

2626

2727
.edit-warning {
28-
@apply --flex-center;
28+
@extend %flex-center;
2929

3030
height: 1.8em;
3131
padding: 0.4em 1em 0.4em 1em;
@@ -43,15 +43,15 @@
4343
left: calc(100% - 2.6em);
4444
animation-name: none;
4545
transition: transform 1s ease 0s, opacity 1s ease 1s;
46-
46+
4747
&.closed {
4848
transform: translateX(100%);
4949
box-shadow: 0px;
5050
opacity: 0;
5151
}
5252
}
53-
54-
53+
54+
5555
.edit-warning {
5656
height: 1.8em;
5757
min-width: 20em;
@@ -61,4 +61,4 @@
6161
box-shadow: var(--box-shadow);
6262
background-color: var(--invalidColor);
6363
}
64-
}
64+
}

src/styles/features/view/graph.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.Graph {
2-
@apply --flex-center;
3-
2+
@extend %flex-center;
3+
44
width: 100%;
55
height: 100%;
66
}

src/styles/features/view/menuBar.css

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.menu-bar {
2-
@apply --flex-center;
2+
@extend %flex-center;
33

44
position: absolute;
55
justify-content: flex-start;
@@ -15,11 +15,11 @@
1515
}
1616

1717
.menu-bar-inner-container {
18-
@apply --flex-center;
18+
@extend %flex-center;
1919
}
2020

2121
.pc-logo-container {
22-
@apply --flex-center;
22+
@extend %flex-center;
2323

2424
height: calc(var(--icon-size) * 3 / 2);
2525
width: calc(var(--icon-size) * 3 / 2);
@@ -41,8 +41,8 @@
4141
}
4242

4343
.layout-dropdown-button {
44-
@apply --flex-center;
45-
@apply --no-select;
44+
@extend %flex-center;
45+
@extend %no-select;
4646

4747
height: calc(var(--icon-size) * 3 / 2);
4848
width: calc(var(--icon-size) * 3 / 2);
@@ -61,7 +61,7 @@
6161
}
6262

6363
.layout-dropdown {
64-
@apply --flex-center;
64+
@extend %flex-center;
6565

6666
display: none;
6767
margin-left: 1em;
@@ -108,4 +108,4 @@
108108
padding-top: 1em;
109109
padding-bottom: 1em;
110110
}
111-
}
111+
}

src/styles/features/view/sidebarMenu.css

+22-22
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
}
5555

5656
.tool-button {
57-
@apply --flex-center;
58-
@apply --no-select;
57+
@extend %flex-center;
58+
@extend %no-select;
5959

6060
height: calc(var(--icon-size) * 3 / 2);
6161
font-size: var(--icon-size);
@@ -85,8 +85,8 @@
8585
}
8686

8787
.sidebar-text {
88-
@apply --flex-center;
89-
88+
@extend %flex-center;
89+
9090
height: 100%;
9191
width: 100%;
9292
z-index: 300;
@@ -106,8 +106,8 @@
106106

107107
/* change someday to global "image-card" component */
108108
.image-card {
109-
@apply --flex-center;
110-
109+
@extend %flex-center;
110+
111111
margin: auto;
112112
margin-top: 1em;
113113
margin-bottom: 1em;
@@ -116,7 +116,7 @@
116116
flex-direction: column;
117117
background-color: white;
118118
box-shadow: 0px 0px 35px 0px rgba(0,0,0,0.75);
119-
119+
120120
& img {
121121
border: 1px solid black;
122122
min-height: 3em;
@@ -139,7 +139,7 @@
139139

140140
.download-option {
141141
/* height: 10em; */
142-
142+
143143
width: 95%;
144144
margin: auto;
145145
box-sizing: border-box;
@@ -151,7 +151,7 @@
151151
border-style: solid;
152152
border-color: black;
153153
border-width: 2px 2px 0px 2px;
154-
154+
155155
&:first-child {
156156
margin-top: 1em;
157157
}
@@ -163,15 +163,15 @@
163163
}
164164

165165
.download-icon-container {
166-
@apply --flex-center;
166+
@extend %flex-center;
167167

168168
width: 30%;
169169
height: 100%;
170170
margin: auto;
171171
}
172172

173173
.download-icon-inner-container {
174-
@apply --flex-center;
174+
@extend %flex-center;
175175

176176
width: var(--icon-size);
177177
height: var(--icon-size);
@@ -205,10 +205,10 @@
205205
left: calc(- var(--icon-size-mobile) * 3 / 2);
206206
height: calc((var(--icon-size-mobile) * 3 / 2) * 4);
207207
width: calc(var(--icon-size-mobile) * 3 / 2);
208-
208+
209209
&.conditional {
210210
height: calc(var(--icon-size-mobile) * 3 / 2);
211-
211+
212212
&.open {
213213
left: calc(- var(--icon-size-mobile) * 3 / 2);
214214
}
@@ -231,12 +231,12 @@
231231
left: 0;
232232
box-shadow: 0px;
233233
transform: translateY(0%);
234-
234+
235235
&.open {
236236
transform: translateY(-100%);
237237
}
238238
}
239-
239+
240240
.sidebar-select {
241241
position: absolute;
242242
top: calc(- var(--icon-size-mobile) * 3 / 2);
@@ -246,39 +246,39 @@
246246
flex-direction: row;
247247
border-width: 2px 2px 0px 2px;
248248
border-radius: 3px 3px 0px 0px;
249-
249+
250250
&.conditional {
251251
height: calc(var(--icon-size-mobile) * 3 / 2);
252252
width: calc(var(--icon-size-mobile) * 3 / 2);
253253
border-width: 2px 2px 0px 0px;
254254
top: 0;
255255
box-shadow: 0px 0px 0px 0px rgba(0,0,0,0.4);
256-
256+
257257
&.open {
258258
top: calc(- var(--icon-size-mobile) * 3 / 2);
259259
left: 0;
260260
box-shadow: var(--box-shadow);
261261
}
262262
}
263263
}
264-
264+
265265
.tool-button {
266266
height: calc(var(--icon-size-mobile) * 3 / 2);
267267
flex-grow: 1;
268268

269269
border-left: 2px solid black;
270270
border-top: 0;
271-
271+
272272
&:first-child {
273273
border-left: 0;
274274
}
275275
}
276-
276+
277277
.sidebar-content {
278278
border-width: 2px 0px 0px 0px;
279279
}
280-
280+
281281
.sidebar-text {
282282
border-width: 10px 0px 0px 0px;
283283
}
284-
}
284+
}

src/styles/vars.css

+11-17
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,6 @@
1414
--link: #03A9F4;
1515
--link-visited: #7E57C2;
1616

17-
--flex-center: {
18-
display: flex;
19-
justify-content: center;
20-
align-items: center;
21-
};
22-
23-
--no-select: {
24-
-webkit-touch-callout: none;
25-
-webkit-user-select: none;
26-
-khtml-user-select: none;
27-
-moz-user-select: none;
28-
-ms-user-select: none;
29-
user-select: none;
30-
31-
cursor: default;
32-
}
33-
3417
--widgetBorderColor: #aaa;
3518
--widgetBorderRadius: 4px;
3619
--widgetDisabledBorderColor: #ddd;
@@ -44,4 +27,15 @@
4427
--invalidColor: #c20e0e;
4528
--smallFontSize: 0.8em;
4629
--fadedColor: #888;
30+
31+
%flex-center {
32+
display: flex;
33+
justify-content: center;
34+
align-items: center;
35+
}
36+
37+
%no-select {
38+
user-select: none;
39+
cursor: default;
40+
}
4741
}

0 commit comments

Comments
 (0)