stylesheets/singularitygs/api/_isolation.scss in singularitygs-1.0.1 vs stylesheets/singularitygs/api/_isolation.scss in singularitygs-1.0.2

- old
+ new

@@ -1,39 +1,84 @@ @mixin output-isolation($span, $location, $columns, $gutter, $options: false) { - @if $options == false { - $options: 'right'; - } - $gutter: find-gutter($gutter); + $end-row: end-row($span, $location, $columns); + $start-row: start-row($location); + // @debug $options; + + @if $direction == 'ltr' or $direction == 'both' { // Set the CSS direction to ltr $cssdir: 'ltr'; // Find the CSS named direction and opposite direction $dir: named-direction($cssdir); $opp: opposite-direction($dir); width: column-span($span, $location, $columns); - margin-#{$dir}: column-span($location - 1, 1, $columns); - margin-#{$opp}: -100%; - float: $dir; - clear: unquote($options); + + + + // If we are at the last item in the row, we float it the opposite direction + @if ($end-row) { + float: $opp; + margin-#{$dir}: 0; + margin-#{$opp}: 0; + } + @else { + float: $dir; + margin-#{$opp}: -100%; + + @if $start-row { + margin-#{$dir}: 0%; + } + @else { + margin-#{$dir}: column-span(($location - 1), 1, $columns) + gutter-span($gutter, $columns); + } + + } + + // If options are set, we clear to that option, otherwise no clear! + @if ($options) { + clear: unquote($options); + } + @else { + clear: none; + } } @if $direction == 'rtl' or $direction == 'both' { // Set the CSS direction to ltr $cssdir: 'rtl'; // Find the CSS named direction and opposite direction $dir: named-direction($cssdir); $opp: opposite-direction($dir); [dir="#{$cssdir}"] & { - margin-#{$dir}: column-span($location - 1, 1, $columns) + gutter-span($gutter, $columns); - margin-#{$opp}: -100%; - float: $dir; - clear: unquote($options); + // If we are at the last item in the row, we float it the opposite direction + @if ($end-row) { + float: $opp; + } + @else { + float: $dir; + margin-#{$opp}: -100%; + + @if $start-row { + margin-#{$dir}: 0%; + } + @else { + margin-#{$dir}: column-span(($location - 1), 1, $columns) + gutter-span($gutter, $columns); + } + } + + // If options are set, we clear to that option, otherwise no clear! + @if ($options) { + clear: unquote($options); + } + @else { + clear: none; + } } } @include span-shared; @@ -43,6 +88,18 @@ @include push-float($span, $location, $columns, $gutter); } @mixin pull-isolation($span, $location, $columns: false, $gutter: false) { @include pull-float($span, $location, $columns, $gutter); +} + +////////////////////////////// +// Happy Syntax for Isolation +// +// Makes working with Isolation easier, as it moves Clear to a 1st class citizen of the mixin, and automatically builds the verbose grid-span mixin call +////////////////////////////// +@mixin isolation-span($span, $location, $clear: false, $columns: false, $gutter: false) { + $grid: find-grid($columns); + $gutter: find-gutter($gutter); + + @include grid-span($span, $location, $grid, $gutter, 'isolation', $clear); } \ No newline at end of file