Skip to content

Instantly share code, notes, and snippets.

@mlebkowski
Created September 25, 2024 11:04
Show Gist options
  • Save mlebkowski/4317c4574cd237e7b57ef88791021079 to your computer and use it in GitHub Desktop.
Save mlebkowski/4317c4574cd237e7b57ef88791021079 to your computer and use it in GitHub Desktop.
$icon-size: 16px;
$icon-sizes: (
sm: $icon-size / 1.5;
md: $icon-size;
lg: $icon-size * 1.5;
)
@function get-map-value($map, $keys...) {
@each $key in $keys {
$isValidKey: map-has-key($map, $key);
@if ($isValidKey == false) {
@warn "There is no element with key: '#{$key}'.";
@return null;
}
$map: map-get($map, $key);
}
@return $map;
}
.some-component {
$__icon {
--icon-size: get-map-value($icon-sizes, sm)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment