|
| 1 | +$prefix: '.flex' |
| 2 | + |
| 3 | +=setDisplayFlex() |
| 4 | + display: flex |
| 5 | + |
| 6 | +@function appendFlexPrefix($value) |
| 7 | + @if $value != center |
| 8 | + $value: unquote('flex-#{$value}') |
| 9 | + @return $value |
| 10 | + @else |
| 11 | + @return $value |
| 12 | + |
| 13 | +=setOrientation($horizontal, $vertical) |
| 14 | + @if $vertical == null |
| 15 | + #{unquote('#{$prefix}-#{$horizontal}')} |
| 16 | + +setDisplayFlex() |
| 17 | + justify-content: appendFlexPrefix($horizontal) |
| 18 | + align-items: appendFlexPrefix($horizontal) |
| 19 | + |
| 20 | + @else |
| 21 | + #{unquote('#{$prefix}-#{$horizontal}-#{$vertical}')} |
| 22 | + +setDisplayFlex() |
| 23 | + justify-content: appendFlexPrefix($horizontal) |
| 24 | + align-items: appendFlexPrefix($vertical) |
| 25 | + |
| 26 | +=setBasis($basis) |
| 27 | + #{ unquote('#{$prefix}-#{$basis}') } |
| 28 | + +setDisplayFlex() |
| 29 | + flex-basis: #{ unquote('#{$basis}%') } |
| 30 | + |
| 31 | + |
| 32 | +#{ unquote('#{$prefix}-row') } |
| 33 | + +setDisplayFlex() |
| 34 | + flex-direction: row |
| 35 | + |
| 36 | +#{ unquote('#{$prefix}-column') } |
| 37 | + +setDisplayFlex() |
| 38 | + flex-direction: column |
| 39 | + |
| 40 | +#{ unquote('#{$prefix}-wrap') } |
| 41 | + +setDisplayFlex() |
| 42 | + flex-wrap: wrap |
| 43 | + |
| 44 | ++setOrientation(start, null) |
| 45 | ++setOrientation(start, start) |
| 46 | ++setOrientation(start, center) |
| 47 | ++setOrientation(start, end) |
| 48 | + |
| 49 | ++setOrientation(center, start) |
| 50 | ++setOrientation(center, null) |
| 51 | ++setOrientation(center, center) |
| 52 | ++setOrientation(center, end) |
| 53 | + |
| 54 | ++setOrientation(end, start) |
| 55 | ++setOrientation(end, center) |
| 56 | ++setOrientation(end, null) |
| 57 | ++setOrientation(end, end) |
| 58 | + |
| 59 | +$i: 5 |
| 60 | +@while $i < 101 |
| 61 | + +setBasis($i) |
| 62 | + $i: $i + 5 |
0 commit comments