Skip to content

Instantly share code, notes, and snippets.

@tranduybau
Created August 2, 2023 16:12
Show Gist options
  • Save tranduybau/2eac773a2682ddce5ef0a1cdeefbe97a to your computer and use it in GitHub Desktop.
Save tranduybau/2eac773a2682ddce5ef0a1cdeefbe97a to your computer and use it in GitHub Desktop.
@mixin generate-border($width, $color, $position: all) {
$shadows: ();
@if $position == all {
$shadows: append($shadows, inset 0 0 0 #{$width} #{$color});
} @else {
@each $dir in top, right, bottom, left {
@if index($position, $dir) {
$x: 0;
$y: 0;
@if $dir == top {
$y: $width;
} @else if $dir == right {
$x: -$width;
} @else if $dir == bottom {
$y: -$width;
} @else if $dir == left {
$x: $width;
}
$shadows: append($shadows, inset #{$x} #{$y} 0 0 #{$color}, comma);
}
}
}
box-shadow: $shadows;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment