From dd5f3c463fab336d694f426dcad11a1783590fc9 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 5 Feb 2022 07:52:13 +0100 Subject: Ported from import syntax to modules --- src/_harmony.scss | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/_harmony.scss') diff --git a/src/_harmony.scss b/src/_harmony.scss index 076fe55..839036c 100644 --- a/src/_harmony.scss +++ b/src/_harmony.scss @@ -9,6 +9,8 @@ //// @use 'sass:math'; +@use './functions'; +@use './responsive'; /// /// Adjust a value to a modular scale. @@ -23,7 +25,7 @@ /// /// @return {number} /// -@function iro-harmony-modular-scale($times, $base, $ratio) { +@function modular-scale($times, $base, $ratio) { @if type-of($base) == number { @return $base * math.pow($ratio, $times); } @@ -31,7 +33,7 @@ $main-base: nth($base, 1); $norm-bases: (); - @each $b in iro-list-slice($base, 2) { + @each $b in functions.list-slice($base, 2) { @if $b > $main-base { @while $b > $main-base { $b: math.div($b, $ratio); @@ -47,7 +49,7 @@ } $all-bases: append($norm-bases, $main-base); - $all-bases: iro-quicksort($all-bases); + $all-bases: functions.quicksort($all-bases); $base-index: $times % length($all-bases) + 1; $exp: math.floor(math.div($times, length($all-bases))); @@ -59,11 +61,11 @@ /// Combine responsive properties with modular scales to achieve responsive modular scales. /// /// @param {string | list} $props - Property or list of properties to set -/// @param {number} $times - Number of iterations. See iro-harmony-modular-scale for more information. +/// @param {number} $times - Number of iterations. See modular-scale for more information. /// @param {number} $responsive-map - A map with keys = viewports and values = modular scales /// @param {bool} $fluid [true] - If enabled, property values will smoothly transition from one viewport to the next /// -/// @see {function} iro-harmony-modular-scale +/// @see {function} modular-scale /// /// @example scss - Responsive font sizes between 2 viewports based on modular scales /// $ms: ( @@ -72,25 +74,25 @@ /// ); /// /// h1 { -/// @include iro-responsive-modular-scale(font-size, 3, $ms); +/// @include responsive-modular-scale(font-size, 3, $ms); /// } /// /// h2 { -/// @include iro-responsive-modular-scale(font-size, 2, $ms); +/// @include responsive-modular-scale(font-size, 2, $ms); /// } /// /// h3 { -/// @include iro-responsive-modular-scale(font-size, 1, $ms); +/// @include responsive-modular-scale(font-size, 1, $ms); /// } /// -@mixin iro-responsive-modular-scale($props, $times, $responsive-map, $fluid: true) { +@mixin responsive-modular-scale($props, $times, $responsive-map, $fluid: true) { $new-map: (); @each $key, $value in $responsive-map { $new-map: map-merge($new-map, ( - $key: iro-harmony-modular-scale($times, $value...) + $key: modular-scale($times, $value...) )); } - @include iro-responsive-property($props, $new-map, $fluid); + @include responsive.property($props, $new-map, $fluid); } -- cgit v1.2.3-54-g00ecf