HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/topswtwmobile.komma.pro/wwwroot/css/mixins/_grid-spacing.sass
@function getGridPropertySize($val,$spacing-key,$space-size)
  // Get direction and factor from the list
  $factor: nth($val, 2)
  $space: nth($spacing-list, $spacing-key)
  // Check if we need to output this
  @if $factor != '-'
    // $property-$dir bv: margin-left,
    // nth($space,1) = spacing value in px,
    // $factor = how many times the spacing.
    @return nth($space,$space-size) * $factor
  @return false
 
// Margin
=grid-spacing($top: '-', $right: '-', $bottom: '-', $left: '-', $spacing-key: 1, $property: margin)
  // Use nested list
  $directions: (top $top) (right $right) (bottom $bottom) (left $left)

  // If all values are != null
  @if $top != '-' and $right != '-' and $bottom != '-' and $left != '-'

    $space: nth($spacing-list, $spacing-key)
    // All properties
    #{$property}: (nth($space,1) * $top) (nth($space,1) * $right) (nth($space,1) * $bottom) (nth($space,1) * $left)
    +respond-to(medium)
      #{$property}: (nth($space,2) * $top) (nth($space,2) * $right) (nth($space,2) * $bottom) (nth($space,2) * $left)
    +respond-to(large)
      #{$property}: (nth($space,3) * $top) (nth($space,3) * $right) (nth($space,3) * $bottom) (nth($space,3) * $left)

  @else
    @if $property != position
      $property: $property + '-'
    @else
      $property: '' 

    // Loop trough $directions
    @each $val in $directions
      $dir: nth($val, 1)
      @if getGridPropertySize($val,$spacing-key,1)
        #{$property}#{$dir}: getGridPropertySize($val,$spacing-key,1)
    +respond-to(medium)
      @each $val in $directions
        $dir: nth($val, 1)
        @if getGridPropertySize($val,$spacing-key,2)
          #{$property}#{$dir}: getGridPropertySize($val,$spacing-key,2)
    +respond-to(large)
      @each $val in $directions
        $dir: nth($val, 1)
        @if getGridPropertySize($val,$spacing-key,3)
          #{$property}#{$dir}: getGridPropertySize($val,$spacing-key,3)


// Margin
=grid-margin($top: '-', $right: '-', $bottom: '-', $left: '-')
  +grid-spacing($top, $right, $bottom, $left)

// Margin Small
=grid-margin-s($top: '-', $right: '-', $bottom: '-', $left: '-')
  +grid-spacing($top, $right, $bottom, $left, 2)

// Padding
=grid-padding($top: '-', $right: '-', $bottom: '-', $left: '-')
  +grid-spacing($top, $right, $bottom, $left, $property: padding)

// Padding Small
=grid-padding-s($top: '-', $right: '-', $bottom: '-', $left: '-')
  +grid-spacing($top, $right, $bottom, $left, $spacing-key: 2,  $property: padding)

// Position
=grid-position($position: absolute, $top: '-', $right: '-', $bottom: '-', $left: '-')
  position: $position
  +grid-spacing($top, $right, $bottom, $left, $spacing-key: 1,  $property: position)

// Position Small
=grid-position-s($position: absolute, $top: '-', $right: '-', $bottom: '-', $left: '-')
  position: $position
  +grid-spacing($top, $right, $bottom, $left, $spacing-key: 2,  $property: position)