Last active
February 5, 2019 08:05
-
-
Save metamn/3f51efec8530e5f21d99212582d2d120 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin latest-posts--regrid-for-ad($max-items-to-display-map, $margin-right) { | |
.dfp-holder { | |
width: 100%; | |
height: 90px; | |
background-color: black; | |
display: flex; | |
} | |
@include media('<tablet') { | |
$max-items-to-display: map-get($max-items-to-display-map, mobile); | |
$half: round($max-items-to-display / 2); | |
> * { | |
@for $i from 1 to 9 { | |
&:nth-child(#{$i}) { | |
@if ($i < $half) { | |
order: #{$i}; | |
} | |
@if ($i > $half) { | |
order: #{$i + 1}; | |
} | |
@if ($i == 5) { | |
order: #{$half}; | |
} | |
} | |
} | |
} | |
} | |
@include media('>=tablet', '<desktop') { | |
$max-items-to-display: map-get($max-items-to-display-map, tablet); | |
$half: round($max-items-to-display / 2); | |
> * { | |
@for $i from 1 to 9 { | |
&:nth-child(#{$i}) { | |
@if ($i < $half) { | |
order: #{$i}; | |
} | |
@if ($i >= $half) { | |
order: #{$i + 1}; | |
} | |
@if ($i == 5) { | |
order: #{$half}; | |
} | |
} | |
} | |
} | |
} | |
@include media('>=desktop', '<laptop') { | |
$max-items-to-display: map-get($max-items-to-display-map, laptop); | |
$half: round($max-items-to-display / 2); | |
> * { | |
@for $i from 1 to 9 { | |
&:nth-child(#{$i}) { | |
@if ($i < $half) { | |
order: #{$i}; | |
} | |
@if ($i >= $half) { | |
order: #{$i + 1}; | |
} | |
@if ($i == 5) { | |
order: #{$half}; | |
} | |
@if ($i == 6) { | |
margin-right: calc(#{$margin-right} / 2); | |
padding-right: calc(#{$margin-right} / 2); | |
@include border(default-right); | |
} | |
@if ($i == 7) { | |
margin-right: 0; | |
padding-right: 0; | |
border: none; | |
} | |
} | |
} | |
} | |
} | |
@include media('>=laptop') { | |
$max-items-to-display: map-get($max-items-to-display-map, desktop); | |
$half: round($max-items-to-display / 2); | |
> * { | |
@for $i from 1 to 10 { | |
&:nth-child(#{$i}) { | |
order: #{$i}; | |
display: flex; | |
@if ($i == 8) { | |
margin-right: calc(#{$margin-right} / 2); | |
padding-right: calc(#{$margin-right} / 2); | |
@include border(default-right); | |
} | |
@if ($i == 9) { | |
margin-right: 0; | |
padding-right: 0; | |
border: none; | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment