Clone
// Foundation for Sites by ZURB
// foundation.zurb.com
// Licensed under MIT Open Source
////
/// @group grid
////
/// Change the behavior of columns defined inside this mixin to use a different column count.
/// @content
/// @param {Number} $columns - Number of columns to use.
/// @param {Booleam} $root [false]
/// If `false`, selectors inside this mixin will nest inside the parent selector.
/// If `tru`, selectors will not nest.
@mixin grid-context(
$columns,
$root: false
) {
// Store the current column count so it can be re-set later
$old-grid-column-count: $columns;
$grid-column-count: $columns !global;
@if $root {
@at-root { @content; }
}
@else {
@content;
}
// Restore the old column count
$grid-column-count: $old-grid-column-count !global;
}
/// Creates a grid row.
/// @content
/// @param {Number} $columns [null] - Column count for this row. `null` will use the default column count.
/// @param {Keywords} $behavior [null]
/// Modifications to the default grid styles. `nest` indicates the row will be placed inside another row. `collapse` indicates that the columns inside this row will not have padding. `nest collapse` combines both behaviors.
/// @param {Number} $width [$grid-row-width] - Maximum width of the row.
@mixin grid-row(
$columns: null,
$behavior: null,
$width: $grid-row-width,
$cf: true
) {
$behavior: -zf-get-options($behavior, nest collapse);
$margin: auto;
@if map-get($behavior, nest) {
$margin: rem-calc($grid-column-gutter) / 2 * -1;
@if map-get($behavior, collapse) {
$margin: 0;
}
}
@else {
max-width: $width;
}
@if $cf {
@include clearfix;
}
margin-left: $margin;
margin-right: $margin;
@if $columns != null {
@include grid-context($columns) {
@content;
}
}
}