Skip to content

Commit 0dad1a9

Browse files
authored
Merge pull request #29 from mirus-ua/28-media-queries-not-working-properly
fix: rework the styles that are not working properly
2 parents f137753 + ae9fe44 commit 0dad1a9

File tree

9 files changed

+31
-22
lines changed

9 files changed

+31
-22
lines changed

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,18 @@ You can find all of them in the browser's page inspector, but here is the list w
7373
--accent-contrast-color: black; /* mainly uses for text on the accent backgrounds but not limited */
7474
--color: white; /* text color, also some other text use the variable in color mixing */
7575
--border-color: rgba(255, 255, 255, .1); /* border color */
76-
--phone: "max-width: 684px"; /* phone breakpoint */
77-
--tablet: "max-width: 900px"; /* tablet breakpoint */
7876
--article-link-color: var(inherit); /* for you, who want to colorize your article links */
7977

8078
/* code syntax */
8179
/* take a look at themes/re-terminal/assets/css/syntax.scss to understand in detail which color stands for */
8280
--syntax-func-color: color-mix(in srgb, var(--accent) 70%, #999 30%);
8381
--syntax-var-color: color-mix(in srgb, var(--accent) 90%, transparent);
8482
--syntax-value-color: color-mix(in srgb, var(--accent), white);
83+
84+
/* breakpoints */
85+
/* unfortunately, native CSS variables don't support media queries, so use SCSS vars instead */
86+
$phone: 684px;
87+
$tablet: 900px;
8588
}
8689
```
8790

assets/css/footer.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
width: 760px;
1212
max-width: 100%;
1313

14-
@media (var(--tablet)) {
14+
@media (max-width: $tablet) {
1515
flex-direction: column;
1616
}
1717
}

assets/css/main.scss

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ body {
2424
-webkit-overflow-scrolling: touch;
2525
-webkit-text-size-adjust: 100%;
2626

27-
@media (var(--phone)) {
27+
@media (max-width: $phone) {
2828
font-size: 1rem;
2929
}
3030
}
@@ -157,7 +157,7 @@ pre {
157157
margin-top: -40px;
158158
}
159159

160-
@media (var(--phone)) {
160+
@media (max-width: $phone) {
161161
white-space: pre-wrap;
162162
word-wrap: break-word;
163163
}
@@ -177,7 +177,7 @@ blockquote {
177177
margin: 40px 0;
178178
padding: 25px;
179179

180-
@media (var(--phone)) {
180+
@media (max-width: $phone) {
181181
padding-right: 0;
182182
}
183183

@@ -254,7 +254,7 @@ ol {
254254
position: relative;
255255
}
256256

257-
@media (var(--phone)) {
257+
@media (max-width: $phone) {
258258
margin-left: 20px;
259259
}
260260
}
@@ -312,7 +312,7 @@ mark {
312312
max-width: 100%;
313313
}
314314

315-
@media (var(--phone)) {
315+
@media (max-width: $phone) {
316316
padding: 20px;
317317
}
318318

assets/css/menu.scss

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
justify-content: space-between;
3434
margin: 20px 1px;
3535

36-
@media (var(--phone)) {
36+
@media (max-width: $phone) {
3737
margin: 0;
3838
}
3939

@@ -55,7 +55,7 @@
5555
}
5656
}
5757

58-
@media (var(--phone)) {
58+
@media (max-width: $phone) {
5959
flex-direction: column;
6060
align-items: flex-start;
6161
padding: 0;
@@ -118,7 +118,7 @@
118118
}
119119

120120
&--desktop {
121-
@media (var(--phone)) {
121+
@media (max-width: $phone) {
122122
display: none
123123
}
124124
}
@@ -128,13 +128,13 @@
128128
@include header-menu-trigger;
129129
display: none;
130130

131-
@media (var(--phone)) {
131+
@media (max-width: $phone) {
132132
display: block;
133133
}
134134
}
135135

136136
.menu__dropdown {
137-
@media (var(--phone)) {
137+
@media (max-width: $phone) {
138138
left: auto;
139139
right: 0;
140140
}
@@ -153,7 +153,7 @@
153153
.menu__trigger {
154154
@include header-menu-trigger;
155155

156-
@media (var(--phone)) {
156+
@media (max-width: $phone) {
157157
display: none;
158158
}
159159
}

assets/css/pagination.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
padding: 0;
5757
appearance: none;
5858

59-
@media(var(--phone)) {
59+
@media(max-width: $phone) {
6060
flex: 1;
6161
}
6262

assets/css/post.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
margin: 40px 0;
9191
padding: 20px;
9292

93-
@media (var(--phone)) {
93+
@media (max-width: $phone) {
9494
padding: 10px;
9595
border-width: 10px;
9696
}

assets/css/variables.scss

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
--border-color: rgba(255, 255, 255, .1);
77
--article-link-color: var(inherit);
88

9-
/* MEDIA QUERIES */
10-
--phone: "max-width: 684px";
11-
--tablet: "max-width: 900px";
9+
// Native CSS Variable aren't supported in a combination with MEDIA QUERIES. Wait for a new standard https://drafts.csswg.org/css-env-1/
10+
// --phone: "max-width: 684px";
11+
// --tablet: "max-width: 900px";
12+
13+
$phone: 684px;
14+
$tablet: 900px;
1215
}

demoSite/content/posts/css-vars.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,17 @@ You can find all of them in the browser's page inspector, but here is the list w
4444
--accent-contrast-color: black; /* mainly uses for text on the accent backgrounds but not limited */
4545
--color: white; /* text color, also some other text use the variable in color mixing */
4646
--border-color: rgba(255, 255, 255, .1); /* border color */
47-
--phone: "max-width: 684px"; /* phone breakpoint */
48-
--tablet: "max-width: 900px"; /* tablet breakpoint */
4947

5048
/* code syntax */
5149
/* take a look at themes/re-terminal/assets/css/syntax.scss to understand in detail which color stands for */
5250
--syntax-func-color: color-mix(in srgb, var(--accent) 70%, #999 30%);
5351
--syntax-var-color: color-mix(in srgb, var(--accent) 90%, transparent);
5452
--syntax-value-color: color-mix(in srgb, var(--accent), white);
53+
54+
/* breakpoints */
55+
/* unfortunately, native CSS variables don't support media queries, so use SCSS vars instead */
56+
$phone: 684px;
57+
$tablet: 900px;
5558
}
5659
```
5760

demoSite/content/showcase.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pre {
2828
font-size: 1rem;
2929
overflow: auto;
3030

31-
@media (--phone) {
31+
@media ($phone) {
3232
white-space: pre-wrap;
3333
word-wrap: break-word;
3434
}

0 commit comments

Comments
 (0)