diff --git a/README.md b/README.md index ffea27a..638aaa5 100644 --- a/README.md +++ b/README.md @@ -73,8 +73,6 @@ You can find all of them in the browser's page inspector, but here is the list w --accent-contrast-color: black; /* mainly uses for text on the accent backgrounds but not limited */ --color: white; /* text color, also some other text use the variable in color mixing */ --border-color: rgba(255, 255, 255, .1); /* border color */ - --phone: "max-width: 684px"; /* phone breakpoint */ - --tablet: "max-width: 900px"; /* tablet breakpoint */ --article-link-color: var(inherit); /* for you, who want to colorize your article links */ /* code syntax */ @@ -82,6 +80,11 @@ You can find all of them in the browser's page inspector, but here is the list w --syntax-func-color: color-mix(in srgb, var(--accent) 70%, #999 30%); --syntax-var-color: color-mix(in srgb, var(--accent) 90%, transparent); --syntax-value-color: color-mix(in srgb, var(--accent), white); + + /* breakpoints */ + /* unfortunately, native CSS variables don't support media queries, so use SCSS vars instead */ + $phone: 684px; + $tablet: 900px; } ``` diff --git a/assets/css/footer.scss b/assets/css/footer.scss index fa33790..a405574 100644 --- a/assets/css/footer.scss +++ b/assets/css/footer.scss @@ -11,7 +11,7 @@ width: 760px; max-width: 100%; - @media (var(--tablet)) { + @media (max-width: $tablet) { flex-direction: column; } } diff --git a/assets/css/main.scss b/assets/css/main.scss index c2e9ebe..824cac5 100644 --- a/assets/css/main.scss +++ b/assets/css/main.scss @@ -24,7 +24,7 @@ body { -webkit-overflow-scrolling: touch; -webkit-text-size-adjust: 100%; - @media (var(--phone)) { + @media (max-width: $phone) { font-size: 1rem; } } @@ -157,7 +157,7 @@ pre { margin-top: -40px; } - @media (var(--phone)) { + @media (max-width: $phone) { white-space: pre-wrap; word-wrap: break-word; } @@ -177,7 +177,7 @@ blockquote { margin: 40px 0; padding: 25px; - @media (var(--phone)) { + @media (max-width: $phone) { padding-right: 0; } @@ -254,7 +254,7 @@ ol { position: relative; } - @media (var(--phone)) { + @media (max-width: $phone) { margin-left: 20px; } } @@ -312,7 +312,7 @@ mark { max-width: 100%; } - @media (var(--phone)) { + @media (max-width: $phone) { padding: 20px; } diff --git a/assets/css/menu.scss b/assets/css/menu.scss index 1fdca53..5038dd2 100644 --- a/assets/css/menu.scss +++ b/assets/css/menu.scss @@ -33,7 +33,7 @@ justify-content: space-between; margin: 20px 1px; - @media (var(--phone)) { + @media (max-width: $phone) { margin: 0; } @@ -55,7 +55,7 @@ } } - @media (var(--phone)) { + @media (max-width: $phone) { flex-direction: column; align-items: flex-start; padding: 0; @@ -118,7 +118,7 @@ } &--desktop { - @media (var(--phone)) { + @media (max-width: $phone) { display: none } } @@ -128,13 +128,13 @@ @include header-menu-trigger; display: none; - @media (var(--phone)) { + @media (max-width: $phone) { display: block; } } .menu__dropdown { - @media (var(--phone)) { + @media (max-width: $phone) { left: auto; right: 0; } @@ -153,7 +153,7 @@ .menu__trigger { @include header-menu-trigger; - @media (var(--phone)) { + @media (max-width: $phone) { display: none; } } diff --git a/assets/css/pagination.scss b/assets/css/pagination.scss index b773130..cf08fcc 100644 --- a/assets/css/pagination.scss +++ b/assets/css/pagination.scss @@ -56,7 +56,7 @@ padding: 0; appearance: none; - @media(var(--phone)) { + @media(max-width: $phone) { flex: 1; } diff --git a/assets/css/post.scss b/assets/css/post.scss index c77bbe5..10d0126 100644 --- a/assets/css/post.scss +++ b/assets/css/post.scss @@ -90,7 +90,7 @@ margin: 40px 0; padding: 20px; - @media (var(--phone)) { + @media (max-width: $phone) { padding: 10px; border-width: 10px; } diff --git a/assets/css/variables.scss b/assets/css/variables.scss index cbb507c..f93d96f 100644 --- a/assets/css/variables.scss +++ b/assets/css/variables.scss @@ -6,7 +6,10 @@ --border-color: rgba(255, 255, 255, .1); --article-link-color: var(inherit); - /* MEDIA QUERIES */ - --phone: "max-width: 684px"; - --tablet: "max-width: 900px"; + // Native CSS Variable aren't supported in a combination with MEDIA QUERIES. Wait for a new standard https://drafts.csswg.org/css-env-1/ + // --phone: "max-width: 684px"; + // --tablet: "max-width: 900px"; + + $phone: 684px; + $tablet: 900px; } \ No newline at end of file diff --git a/demoSite/content/posts/css-vars.md b/demoSite/content/posts/css-vars.md index 9cf0db2..971fd9b 100644 --- a/demoSite/content/posts/css-vars.md +++ b/demoSite/content/posts/css-vars.md @@ -44,14 +44,17 @@ You can find all of them in the browser's page inspector, but here is the list w --accent-contrast-color: black; /* mainly uses for text on the accent backgrounds but not limited */ --color: white; /* text color, also some other text use the variable in color mixing */ --border-color: rgba(255, 255, 255, .1); /* border color */ - --phone: "max-width: 684px"; /* phone breakpoint */ - --tablet: "max-width: 900px"; /* tablet breakpoint */ /* code syntax */ /* take a look at themes/re-terminal/assets/css/syntax.scss to understand in detail which color stands for */ --syntax-func-color: color-mix(in srgb, var(--accent) 70%, #999 30%); --syntax-var-color: color-mix(in srgb, var(--accent) 90%, transparent); --syntax-value-color: color-mix(in srgb, var(--accent), white); + + /* breakpoints */ + /* unfortunately, native CSS variables don't support media queries, so use SCSS vars instead */ + $phone: 684px; + $tablet: 900px; } ``` diff --git a/demoSite/content/showcase.md b/demoSite/content/showcase.md index a88c7e9..7597e15 100644 --- a/demoSite/content/showcase.md +++ b/demoSite/content/showcase.md @@ -28,7 +28,7 @@ pre { font-size: 1rem; overflow: auto; - @media (--phone) { + @media ($phone) { white-space: pre-wrap; word-wrap: break-word; }