@import './../variable/config.scss';

@function pxToRem($px) {
  @return ($px / $base-font-size) * 1rem;
}

@function strip-units($number) {
  @return $number / ($number * 0 + 1);
}

@mixin remCalc($property, $values...) {
  $max: length($values);
  $pxValues: '';
  $remValues: '';

  @for $i from 1 through $max {
    $value: strip-units(nth($values, $i));
    $base-font-size: strip-units($base-font-size);
    $pxValues: #{$pxValues + $value * $base-font-size}px;

    @if $i < $max {
      $pxValues: #{$pxValues + ' '};
    }
  }

  @for $i from 1 through $max {
    $value: strip-units(nth($values, $i));
    $remValues: #{$remValues + $value}rem;

    @if $i < $max {
      $remValues: #{$remValues + ' '};
    }

    #{$property}: $pxValues;
    #{$property}: $remValues;
  }
}
