/*
 * Creates spacers from 5-50 incremented by 5
 * Custom classes can be used by using the syntax:
 * @include spacers($other: #); ***:`#` is a custom number:***
*/

@use 'sass:map';
@use '../../config' as CONFIG;

@mixin spacers(
  $start: map.get(CONFIG.$SPACERS_INTERNAL, 'start'),
  $end: map.get(CONFIG.$SPACERS_INTERNAL, 'end'),
  $multiplier: map.get(CONFIG.$SPACERS_INTERNAL, 'incrementBy'),
  $other: null,
) {
  @if ($other == null or $other == '') {
    $value: $start;
    @for $i from $start through $end {
      @if ($value < $end) {
        $value: if($i == $start, $value, $value + $multiplier);
        .u-spacer-#{$value} {
          &#{&} {
            clear: both;
            height: #{$value}px;
          }
        }
      }
    }
  } @else {
    .u-spacer-#{$other} {
      &#{&} {
        clear: both;
        height: #{$other}px;
      }
    }
  }
}
