diff options
author | Volpeon <git@volpeon.ink> | 2024-10-16 07:23:39 +0200 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2024-10-16 07:23:39 +0200 |
commit | edf687b4c1ac5b773509af77bf05d25e97f30825 (patch) | |
tree | ad3947ed2d63a9150d117a75dd4746631958b66e | |
parent | Colors (diff) | |
download | iro-design-edf687b4c1ac5b773509af77bf05d25e97f30825.tar.gz iro-design-edf687b4c1ac5b773509af77bf05d25e97f30825.tar.bz2 iro-design-edf687b4c1ac5b773509af77bf05d25e97f30825.zip |
Put var application into mixin
-rw-r--r-- | src/_apply-vars.scss | 17 | ||||
-rw-r--r-- | src/_declare-vars.scss | 16 | ||||
-rw-r--r-- | src/index.scss | 4 | ||||
-rw-r--r-- | src_demo/index.scss | 4 |
4 files changed, 20 insertions, 21 deletions
diff --git a/src/_apply-vars.scss b/src/_apply-vars.scss deleted file mode 100644 index a2ee404..0000000 --- a/src/_apply-vars.scss +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | @use 'sass:map'; | ||
2 | @use 'iro-sass/src/index' as iro; | ||
3 | @use 'include-media/dist/include-media' as media; | ||
4 | |||
5 | :root { | ||
6 | @include iro.props-assign; | ||
7 | |||
8 | @each $breakpoint in map.keys(media.$breakpoints) { | ||
9 | @include media.media('<=#{$breakpoint}') { | ||
10 | @include iro.props-assign($breakpoint); | ||
11 | } | ||
12 | } | ||
13 | |||
14 | @media (prefers-color-scheme: dark) { | ||
15 | @include iro.props-assign('dark'); | ||
16 | } | ||
17 | } | ||
diff --git a/src/_declare-vars.scss b/src/_declare-vars.scss index 0aa1cca..afe1e15 100644 --- a/src/_declare-vars.scss +++ b/src/_declare-vars.scss | |||
@@ -271,3 +271,19 @@ | |||
271 | ), | 271 | ), |
272 | ), $tree); | 272 | ), $tree); |
273 | } | 273 | } |
274 | |||
275 | @mixin apply-vars { | ||
276 | :root { | ||
277 | @include iro.props-assign; | ||
278 | |||
279 | @each $breakpoint in map.keys(media.$breakpoints) { | ||
280 | @include media.media('<=#{$breakpoint}') { | ||
281 | @include iro.props-assign($breakpoint); | ||
282 | } | ||
283 | } | ||
284 | |||
285 | @media (prefers-color-scheme: dark) { | ||
286 | @include iro.props-assign('dark'); | ||
287 | } | ||
288 | } | ||
289 | } | ||
diff --git a/src/index.scss b/src/index.scss index 50927e2..bae26bc 100644 --- a/src/index.scss +++ b/src/index.scss | |||
@@ -1,4 +1,4 @@ | |||
1 | @use 'declare-vars'; | 1 | @use 'declare-vars' as vars; |
2 | 2 | ||
3 | @use 'base'; | 3 | @use 'base'; |
4 | @use 'layouts'; | 4 | @use 'layouts'; |
@@ -7,4 +7,4 @@ | |||
7 | @use 'themes'; | 7 | @use 'themes'; |
8 | @use 'utils'; | 8 | @use 'utils'; |
9 | 9 | ||
10 | @use 'apply-vars'; | 10 | @include vars.apply-vars; |
diff --git a/src_demo/index.scss b/src_demo/index.scss index 4845e03..22472a3 100644 --- a/src_demo/index.scss +++ b/src_demo/index.scss | |||
@@ -1,4 +1,4 @@ | |||
1 | @use '../src/declare-vars'; | 1 | @use '../src/declare-vars' as vars; |
2 | 2 | ||
3 | @use '../src/base'; | 3 | @use '../src/base'; |
4 | @use 'base' as demo-base; | 4 | @use 'base' as demo-base; |
@@ -14,5 +14,5 @@ | |||
14 | @use '../src/themes'; | 14 | @use '../src/themes'; |
15 | @use '../src/utils'; | 15 | @use '../src/utils'; |
16 | 16 | ||
17 | @use '../src/apply-vars'; | 17 | @include vars.apply-vars; |
18 | 18 | ||