From 056a4d347460854d291149a52def7967eea10a69 Mon Sep 17 00:00:00 2001 From: Deborah Jean Date: Fri, 26 Sep 2025 16:33:45 +0200 Subject: [PATCH] Fix deprecated functions in sass files --- src/scss/_config.scss | 7 +-- src/scss/_functions.scss | 9 ++-- src/scss/_theme.scss | 42 ++++++++------- src/scss/_typography.scss | 12 +++-- src/scss/components/_button.scss | 4 +- src/scss/components/_form.scss | 5 +- src/scss/components/_intro.scss | 6 ++- src/scss/components/_modal.scss | 5 +- src/scss/components/_nav.scss | 4 +- src/scss/components/_post.scss | 32 ++++++----- src/scss/components/_skip-link.scss | 5 +- src/scss/global.scss | 73 ++++++++++++-------------- src/scss/utilities/_inner-wrapper.scss | 10 ++-- src/scss/utilities/_wrapper.scss | 10 ++-- 14 files changed, 130 insertions(+), 94 deletions(-) diff --git a/src/scss/_config.scss b/src/scss/_config.scss index bcc0d44..9448561 100644 --- a/src/scss/_config.scss +++ b/src/scss/_config.scss @@ -1,4 +1,5 @@ -@import 'tokens'; +@use 'tokens'; +@use 'sass:map'; /** * SIZE SCALE @@ -6,14 +7,14 @@ * it is relevant for (font-size, margin, padding). All items are * calcuated off these tokens. */ -$size-scale: map-get($tokens, 'size-scale'); +$size-scale: map.get(tokens.$tokens, 'size-scale'); /** * COLORS * Colors are shared between backgrounds and text by default. * You can also use them to power borders, fills or shadows, for example. */ -$colors: map-get($tokens, 'colors'); +$colors: map.get(tokens.$tokens, 'colors'); /** * METRICS diff --git a/src/scss/_functions.scss b/src/scss/_functions.scss index 9f9bcc1..a7d5aef 100644 --- a/src/scss/_functions.scss +++ b/src/scss/_functions.scss @@ -1,3 +1,6 @@ +@use 'tokens'; +@use 'sass:map'; + /** * CUSTOM FUNCTIONS * Replacement functions for stalfos get-size() and get-color() functions @@ -10,9 +13,9 @@ */ @function get-size($size) { @if $size == 'base' { - @return map-get($tokens, 'size-scale', 'base'); + @return map.get(tokens.$tokens, 'size-scale', 'base'); } - @return map-get($tokens, 'size-scale', $size); + @return map.get(tokens.$tokens, 'size-scale', $size); } /** @@ -21,5 +24,5 @@ * @return {string} - The color value */ @function get-color($color) { - @return map-get($tokens, 'colors', $color); + @return map.get(tokens.$tokens, 'colors', $color); } diff --git a/src/scss/_theme.scss b/src/scss/_theme.scss index 84dd54c..3006d34 100644 --- a/src/scss/_theme.scss +++ b/src/scss/_theme.scss @@ -1,28 +1,32 @@ +@use 'config'; +@use 'functions'; +@use 'sass:list'; + :root { // Pull the tokens and generate custom props - @each $color in $colors { - #{'--color-' + nth($color, 1)}: #{nth($color, 2)}; + @each $color in config.$colors { + #{'--color-' + list.nth($color, 1)}: #{list.nth($color, 2)}; } // Set theme aliases --color-mode: 'light'; - --color-bg: #{get-color('light')}; - --color-bg-glare: #{get-color('light')}; - --color-text: #{get-color('dark')}; - --color-text-glare: #{get-color('dark')}; - --color-selection-text: #{get-color('light')}; - --color-selection-bg: #{get-color('dark')}; - --color-stroke: #{get-color('mid')}; - --color-action-bg: #{get-color('primary')}; - --color-action-text: #{get-color('dark')}; - --color-theme-primary: #{get-color('primary')}; - --color-theme-primary-glare: #{get-color('primary-glare')}; - --color-theme-highlight: #{get-color('highlight')}; - --color-theme-highlight-block: #{get-color('highlight')}; - --color-theme-secondary: #{get-color('secondary')}; - --color-light-gray: #{get-color('light-gray')}; - --color-light-blue: #{get-color('light-blue')}; - --color-white: #{get-color('light')}; + --color-bg: #{functions.get-color('light')}; + --color-bg-glare: #{functions.get-color('light')}; + --color-text: #{functions.get-color('dark')}; + --color-text-glare: #{functions.get-color('dark')}; + --color-selection-text: #{functions.get-color('light')}; + --color-selection-bg: #{functions.get-color('dark')}; + --color-stroke: #{functions.get-color('mid')}; + --color-action-bg: #{functions.get-color('primary')}; + --color-action-text: #{functions.get-color('dark')}; + --color-theme-primary: #{functions.get-color('primary')}; + --color-theme-primary-glare: #{functions.get-color('primary-glare')}; + --color-theme-highlight: #{functions.get-color('highlight')}; + --color-theme-highlight-block: #{functions.get-color('highlight')}; + --color-theme-secondary: #{functions.get-color('secondary')}; + --color-light-gray: #{functions.get-color('light-gray')}; + --color-light-blue: #{functions.get-color('light-blue')}; + --color-white: #{functions.get-color('light')}; } body { diff --git a/src/scss/_typography.scss b/src/scss/_typography.scss index deed951..28445e1 100644 --- a/src/scss/_typography.scss +++ b/src/scss/_typography.scss @@ -1,3 +1,7 @@ +@use 'tokens'; +@use 'functions'; +@use 'sass:map'; + /* varela-round-regular - latin */ @font-face { font-family: 'Varela Round'; @@ -57,8 +61,8 @@ } body { - $line-height: get-size(600); - font-family: #{map-get($tokens, 'fonts', 'base')}; + $line-height: functions.get-size(600); + font-family: #{map.get(tokens.$tokens, 'fonts', 'base')}; // Strip the unit off the size ratio to generate a line height line-height: calc($line-height / 1); @@ -66,7 +70,7 @@ body { h1, h2 { - font-family: #{map-get($tokens, 'fonts', 'brand')}; + font-family: #{map.get(tokens.$tokens, 'fonts', 'brand')}; } h1 { @@ -81,7 +85,7 @@ h2 { } h3 { - font-size: get-size(500); + font-size: functions.get-size(500); } @media (max-width: 575.98px) { diff --git a/src/scss/components/_button.scss b/src/scss/components/_button.scss index 885f6cb..c1a7fe8 100644 --- a/src/scss/components/_button.scss +++ b/src/scss/components/_button.scss @@ -1,10 +1,12 @@ +@use '../functions'; + .button, .btn { display: inline-block; border: 0; background-color: var(--color-action-bg); color: var(--color-action-text); - padding: get-size(300) get-size('base'); + padding: functions.get-size(300) functions.get-size('base'); line-height: 1; margin: 0; text-decoration: none; diff --git a/src/scss/components/_form.scss b/src/scss/components/_form.scss index 9f1e785..f968695 100644 --- a/src/scss/components/_form.scss +++ b/src/scss/components/_form.scss @@ -1,3 +1,6 @@ +@use '../tokens'; +@use 'sass:map'; + .home .form-container { svg > path:first-child { fill: #f1f0f6; @@ -40,7 +43,7 @@ label { input, textarea, select { - font-family: #{map-get($tokens, 'fonts', 'base')}; + font-family: #{map.get(tokens.$tokens, 'fonts', 'base')}; background-color: var(--color-primary-glare); font: inherit; border: 0; diff --git a/src/scss/components/_intro.scss b/src/scss/components/_intro.scss index 27c4203..c851078 100644 --- a/src/scss/components/_intro.scss +++ b/src/scss/components/_intro.scss @@ -1,3 +1,5 @@ +@use '../functions'; + .intro { margin-top: 8rem; @@ -7,8 +9,8 @@ } &__summary { - --flow-space: #{get-size(500)}; - font-size: get-size(500); + --flow-space: #{functions.get-size(500)}; + font-size: functions.get-size(500); a { color: currentColor; diff --git a/src/scss/components/_modal.scss b/src/scss/components/_modal.scss index b3ad986..f444a7b 100644 --- a/src/scss/components/_modal.scss +++ b/src/scss/components/_modal.scss @@ -1,3 +1,6 @@ +@use '../tokens'; +@use 'sass:map'; + .modal-content { border: 0; border-radius: 1.5rem; @@ -10,7 +13,7 @@ } h3 { - font-family: #{map-get($tokens, 'fonts', 'brand')}; + font-family: #{map.get(tokens.$tokens, 'fonts', 'brand')}; font-size: 1.5rem; } } diff --git a/src/scss/components/_nav.scss b/src/scss/components/_nav.scss index 8c7741f..e1a6417 100644 --- a/src/scss/components/_nav.scss +++ b/src/scss/components/_nav.scss @@ -1,3 +1,5 @@ +@use '../functions'; + .nav { &__list { overflow-x: auto; @@ -19,7 +21,7 @@ } &__item { - padding: get-size(300) 0; + padding: functions.get-size(300) 0; flex-shrink: 0; a { diff --git a/src/scss/components/_post.scss b/src/scss/components/_post.scss index 41b552f..14ff8af 100644 --- a/src/scss/components/_post.scss +++ b/src/scss/components/_post.scss @@ -1,3 +1,9 @@ +@use '../config'; +@use '../functions'; +@use '../tokens'; +@use '../utilities/visually-hidden'; +@use 'sass:map'; + .post { margin-bottom: 8rem; @@ -38,23 +44,23 @@ blockquote { border-left: .4rem solid var(--color-theme-primary-glare); margin-left: 0; - padding-left: get-size(500); + padding-left: functions.get-size(500); font-style: italic; - font-size: get-size(600); + font-size: functions.get-size(600); p { opacity: .85; - padding: get-size(500) 0; + padding: functions.get-size(500) 0; } } ol:not([class]), ul:not([class]) { - margin-left: get-size(800); + margin-left: functions.get-size(800); margin-bottom: 1rem; li + li { - margin-top: get-size(300); + margin-top: functions.get-size(300); } } @@ -64,7 +70,7 @@ .video-player, .video-player + *, video { - --flow-space: #{get-size('max')}; + --flow-space: #{functions.get-size('max')}; } figure, @@ -72,7 +78,7 @@ .video-player, video { width: 100%; - max-width: map-get($metrics, 'wrap-max-width'); + max-width: map.get(config.$metrics, 'wrap-max-width'); position: relative; } @@ -84,9 +90,9 @@ figcaption { font-size: .8em; font-style: italic; - max-width: map-get($metrics, 'wrap-inner-max-width'); + max-width: map.get(config.$metrics, 'wrap-inner-max-width'); margin: .5rem auto 0; - padding: 0 get-size(500); + padding: 0 functions.get-size(500); } .post-info { @@ -103,8 +109,8 @@ pre > code { display: block; background: var(--color-dark); - padding: get-size(700); - font-size: get-size(500); + padding: functions.get-size(700); + font-size: functions.get-size(500); } // page specific @@ -288,7 +294,7 @@ } h2 { - font-family: #{map-get($tokens, 'fonts', 'base')}; + font-family: #{map.get(tokens.$tokens, 'fonts', 'base')}; text-align: left; font-weight: 600; margin-bottom: 1rem; @@ -328,7 +334,7 @@ h2 { flex-shrink: 0; - margin-right: get-size('base'); + margin-right: functions.get-size('base'); color: var(--color-dark); } diff --git a/src/scss/components/_skip-link.scss b/src/scss/components/_skip-link.scss index 6bd377d..9869488 100644 --- a/src/scss/components/_skip-link.scss +++ b/src/scss/components/_skip-link.scss @@ -1,3 +1,6 @@ +@use '../functions'; +@use '../utilities/visually-hidden'; + .skip-link:not(:focus) { @extend %visually-hidden; } @@ -7,7 +10,7 @@ position: absolute; top: 0; left: 0; - padding: get-size(300) get-size(500) get-size('base') get-size(500); + padding: functions.get-size(300) functions.get-size(500) functions.get-size('base') functions.get-size(500); background-color: var(--color-action-bg); color: var(--color-action-text); line-height: 1; diff --git a/src/scss/global.scss b/src/scss/global.scss index be7a4a1..3ca8025 100644 --- a/src/scss/global.scss +++ b/src/scss/global.scss @@ -1,10 +1,38 @@ -@import 'config'; -@import 'functions'; +@use 'config'; +@use 'functions'; +@use 'sass:map'; +@use 'sass:list'; +@use 'theme'; +@use 'typography'; -@import 'theme'; +// Utils +@use 'utilities/inner-wrapper'; +@use 'utilities/visually-hidden'; +@use 'utilities/wrapper'; -// Local dependencies -@import 'typography'; +// Components +@use 'components/button'; +@use 'components/faq'; +@use 'components/form'; +@use 'components/heading-permalink'; +@use 'components/intro'; +@use 'components/nav'; +@use 'components/posts'; +@use 'components/post'; +@use 'components/meeting'; +@use 'components/member'; +@use 'components/member-list'; +@use 'components/modal'; +@use 'components/posts-list'; +@use 'components/presentation'; +@use 'components/site-head'; +@use 'components/site-foot'; +@use 'components/partner'; +@use 'components/skip-link'; +@use 'components/video-player'; +@use 'components/search-bar'; +@use 'components/tags'; +@use 'utilities/responsive'; /** * GLOBAL STYLES @@ -34,7 +62,7 @@ hr { max-width: 500px; background: var(--color-stroke); border: 0; - margin: get-size(900) auto; + margin: functions.get-size(900) auto; } // For when metric attributes are added to img elements @@ -68,36 +96,3 @@ ol[class], ul[class] { list-style: none; } - -/** - * PROJECT IMPORTS - */ - -// Utils -@import 'utilities/inner-wrapper'; -@import 'utilities/visually-hidden'; -@import 'utilities/wrapper'; - -// Components -@import 'components/button'; -@import 'components/faq'; -@import 'components/form'; -@import 'components/heading-permalink'; -@import 'components/intro'; -@import 'components/nav'; -@import 'components/posts'; -@import 'components/post'; -@import 'components/meeting'; -@import 'components/member'; -@import 'components/member-list'; -@import 'components/modal'; -@import 'components/posts-list'; -@import 'components/presentation'; -@import 'components/site-head'; -@import 'components/site-foot'; -@import 'components/partner'; -@import 'components/skip-link'; -@import 'components/video-player'; -@import 'components/search-bar'; -@import 'components/tags'; -@import 'utilities/responsive'; diff --git a/src/scss/utilities/_inner-wrapper.scss b/src/scss/utilities/_inner-wrapper.scss index 9a922f0..47e0819 100644 --- a/src/scss/utilities/_inner-wrapper.scss +++ b/src/scss/utilities/_inner-wrapper.scss @@ -1,7 +1,11 @@ +@use '../config'; +@use '../functions'; +@use 'sass:map'; + .inner-wrapper { - max-width: map-get($metrics, 'wrap-inner-max-width'); + max-width: map.get(config.$metrics, 'wrap-inner-max-width'); margin-left: auto; margin-right: auto; - padding-left: get-size(500); - padding-right: get-size(500); + padding-left: functions.get-size(500); + padding-right: functions.get-size(500); } diff --git a/src/scss/utilities/_wrapper.scss b/src/scss/utilities/_wrapper.scss index 39d53b7..77893ce 100644 --- a/src/scss/utilities/_wrapper.scss +++ b/src/scss/utilities/_wrapper.scss @@ -1,7 +1,11 @@ +@use '../config'; +@use '../functions'; +@use 'sass:map'; + .wrapper { - max-width: map-get($metrics, 'wrap-max-width'); + max-width: map.get(config.$metrics, 'wrap-max-width'); margin-left: auto; margin-right: auto; - padding-left: get-size(500); - padding-right: get-size(500); + padding-left: functions.get-size(500); + padding-right: functions.get-size(500); }