AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 1 | .grid-section { |
Einav Weiss Keidar | 1801b24 | 2018-08-13 16:19:46 +0300 | [diff] [blame] | 2 | $gridItemSpace: 15%; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 3 | |
Einav Weiss Keidar | 1801b24 | 2018-08-13 16:19:46 +0300 | [diff] [blame] | 4 | @mixin gridCol($numOfCols, $flexBasis) { |
| 5 | .#{grid-col- + $numOfCols} { |
| 6 | @extend %grid-col-base; |
| 7 | flex-basis: $flexBasis; |
| 8 | &:not(.last-col-in-row):after { |
| 9 | flex-basis: $gridItemSpace / $numOfCols; |
| 10 | content: ' '; |
| 11 | } |
| 12 | } |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 13 | } |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 14 | |
Einav Weiss Keidar | 1801b24 | 2018-08-13 16:19:46 +0300 | [diff] [blame] | 15 | @mixin gridColWithLastColumn($numOfCols, $flexBasis, $flexBasisLast) { |
| 16 | .#{grid-col- + $numOfCols} { |
| 17 | @extend %grid-col-base; |
| 18 | &:not(.last-col-in-row) { |
| 19 | flex-basis: $flexBasis; |
| 20 | margin-right: 5%; |
| 21 | } |
| 22 | &.last-col-in-row { |
| 23 | flex-basis: $flexBasisLast; |
| 24 | } |
| 25 | } |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 26 | } |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 27 | |
Einav Weiss Keidar | 1801b24 | 2018-08-13 16:19:46 +0300 | [diff] [blame] | 28 | &:not(:last-of-type) { |
| 29 | padding-bottom: 30px; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 30 | } |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 31 | |
Einav Weiss Keidar | 1801b24 | 2018-08-13 16:19:46 +0300 | [diff] [blame] | 32 | .grid-items { |
| 33 | display: flex; |
| 34 | flex-direction: row; |
| 35 | flex-wrap: wrap; |
| 36 | } |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 37 | |
Einav Weiss Keidar | 1801b24 | 2018-08-13 16:19:46 +0300 | [diff] [blame] | 38 | %grid-col-base { |
| 39 | flex-shrink: 0; |
| 40 | display: flex; |
| 41 | } |
| 42 | |
| 43 | .grid-item { |
| 44 | flex: 1; |
| 45 | display: flex; |
| 46 | flex-direction: column; |
| 47 | } |
| 48 | |
| 49 | .grid-item-stretch { |
| 50 | @extend .grid-item; |
| 51 | & *:last-child { |
| 52 | flex: 1; |
| 53 | display: flex; |
| 54 | flex-direction: column; |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | &.has-last-col-set { |
| 59 | @include gridColWithLastColumn(1, 21%, 22%); |
| 60 | @include gridColWithLastColumn(2, 47%, 48%); |
| 61 | @include gridColWithLastColumn(3, 73%, 74%); |
| 62 | @include gridColWithLastColumn(4, 100%, 100%); |
| 63 | } |
| 64 | |
| 65 | &:not(.has-last-col-set) { |
Tufman, Shay (st198j) | 4819f02 | 2020-03-25 14:41:45 +0200 | [diff] [blame] | 66 | @include gridCol(1, 33%); |
Einav Weiss Keidar | 1801b24 | 2018-08-13 16:19:46 +0300 | [diff] [blame] | 67 | @include gridCol(2, 50%); |
| 68 | @include gridCol(3, 75%); |
| 69 | @include gridCol(4, 100%); |
| 70 | } |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 71 | } |