diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-09-28 18:03:43 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-10-24 12:25:00 +0200 |
| commit | 837e0e904c40f7b87561c34ca3f49edd5d8d1c52 (patch) | |
| tree | 37835dd2c84ed770b5719152aab0b74d93c0878c /src/styles/abstracts | |
| parent | d17d894f398650209c0ddd29502308de8c07bd93 (diff) | |
feat(components): replace icons with a generic Icon component
Sizes are also predefined and can be set using the `size` prop,
so the consumers should no longer adjust the size in CSS.
Diffstat (limited to 'src/styles/abstracts')
| -rw-r--r-- | src/styles/abstracts/_variables.scss | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/styles/abstracts/_variables.scss b/src/styles/abstracts/_variables.scss index d56ba18..49e8e26 100644 --- a/src/styles/abstracts/_variables.scss +++ b/src/styles/abstracts/_variables.scss @@ -121,6 +121,43 @@ $font-sizes: (); } //============================================================================ +// Icons +//============================================================================ + +$icon_ratio: get-ratio("perfect-fourth"); +$icon-size_base: fun.convert-px(32); + +$icon-size_levels: "xs", "sm", "md", "lg", "xl"; + +// We start with xs icon, so it needs to be less than the base. +$icon-size_current: math.div($icon-size_base, $icon_ratio * 2); + +/// Icons map ('sm', 'md', 'lg'...) +/// @prop {String} keys - Size as key is mapped to a given icon +/// @prop {Map} value - Value is actual icon +$icon-sizes: (); + +/// We fill our icon-sizes map. +@each $level in $icon-size_levels { + $icon-size_current: $icon-size_current * $icon_ratio; + $icon-sizes: map.merge( + $icon-sizes, + ( + $level: $icon-size_current, + ) + ); +} + +// We cannot declare this function with others functions due to module loop. + +/// Get icon-size. +/// @param {String} $name - Icon size ('sm', 'md', 'lg'...). +/// @return {Integer} The icon value. +@function icon-size($key) { + @return map.get($icon-sizes, $key); +} + +//============================================================================ // Spacings //============================================================================ |
