2014-12-02 17:02:35 -05:00
|
|
|
/// Grid system
|
|
|
|
//
|
|
|
|
// Generate semantic grid columns with these mixins.
|
|
|
|
|
2018-12-14 11:30:12 -05:00
|
|
|
@mixin make-row($gutter: $grid-gutter-width) {
|
2020-04-15 12:52:16 -04:00
|
|
|
--bs-gutter-x: #{$gutter};
|
|
|
|
--bs-gutter-y: 0;
|
2016-12-21 23:26:17 -05:00
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
2020-04-15 12:52:16 -04:00
|
|
|
margin-top: calc(var(--bs-gutter-y) * -1); // stylelint-disable-line function-blacklist
|
|
|
|
margin-right: calc(var(--bs-gutter-x) / -2); // stylelint-disable-line function-blacklist
|
|
|
|
margin-left: calc(var(--bs-gutter-x) / -2); // stylelint-disable-line function-blacklist
|
2014-12-02 17:02:35 -05:00
|
|
|
}
|
|
|
|
|
2018-12-14 11:30:12 -05:00
|
|
|
@mixin make-col-ready($gutter: $grid-gutter-width) {
|
2019-12-14 06:45:26 -05:00
|
|
|
// Add box sizing if only the grid is loaded
|
|
|
|
box-sizing: if(variable-exists(include-column-box-sizing) and $include-column-box-sizing, border-box, null);
|
2016-07-23 20:12:43 -04:00
|
|
|
// Prevent columns from becoming too narrow when at smaller grid tiers by
|
2019-09-28 10:13:36 -04:00
|
|
|
// always setting `width: 100%;`. This works because we set the width
|
2016-07-23 20:12:43 -04:00
|
|
|
// later on to override this initial width.
|
2019-09-28 10:13:36 -04:00
|
|
|
flex-shrink: 0;
|
2016-12-21 23:26:17 -05:00
|
|
|
width: 100%;
|
2019-09-28 10:13:36 -04:00
|
|
|
max-width: 100%; // Prevent `.col-auto`, `.col` (& responsive variants) from breaking out the grid
|
2020-04-15 12:52:16 -04:00
|
|
|
padding-right: calc(var(--bs-gutter-x) / 2); // stylelint-disable-line function-blacklist
|
|
|
|
padding-left: calc(var(--bs-gutter-x) / 2); // stylelint-disable-line function-blacklist
|
|
|
|
margin-top: var(--bs-gutter-y);
|
2016-07-23 20:12:43 -04:00
|
|
|
}
|
|
|
|
|
2016-09-04 20:43:38 -04:00
|
|
|
@mixin make-col($size, $columns: $grid-columns) {
|
2019-09-28 10:13:36 -04:00
|
|
|
flex: 0 0 auto;
|
|
|
|
width: percentage($size / $columns);
|
2014-12-02 17:02:35 -05:00
|
|
|
}
|
2017-08-15 01:30:44 -04:00
|
|
|
|
2019-10-17 02:46:34 -04:00
|
|
|
@mixin make-col-auto() {
|
|
|
|
flex: 0 0 auto;
|
|
|
|
width: auto;
|
|
|
|
}
|
|
|
|
|
2017-08-15 01:30:44 -04:00
|
|
|
@mixin make-col-offset($size, $columns: $grid-columns) {
|
2017-10-03 15:12:31 -04:00
|
|
|
$num: $size / $columns;
|
|
|
|
margin-left: if($num == 0, 0, percentage($num));
|
2017-08-15 01:30:44 -04:00
|
|
|
}
|
2019-07-24 02:00:29 -04:00
|
|
|
|
|
|
|
// Row columns
|
|
|
|
//
|
|
|
|
// Specify on a parent element(e.g., .row) to force immediate children into NN
|
|
|
|
// numberof columns. Supports wrapping to new lines, but does not do a Masonry
|
|
|
|
// style grid.
|
|
|
|
@mixin row-cols($count) {
|
2020-06-09 09:55:23 -04:00
|
|
|
> * {
|
2019-09-28 10:13:36 -04:00
|
|
|
flex: 0 0 auto;
|
|
|
|
width: 100% / $count;
|
2019-07-24 02:00:29 -04:00
|
|
|
}
|
|
|
|
}
|
2020-02-03 15:02:53 -05:00
|
|
|
|
|
|
|
// Framework grid generation
|
|
|
|
//
|
|
|
|
// Used only by Bootstrap to generate the correct number of grid classes given
|
|
|
|
// any value of `$grid-columns`.
|
|
|
|
|
|
|
|
@mixin make-grid-columns($columns: $grid-columns, $gutter: $grid-gutter-width, $breakpoints: $grid-breakpoints) {
|
|
|
|
@each $breakpoint in map-keys($breakpoints) {
|
|
|
|
$infix: breakpoint-infix($breakpoint, $breakpoints);
|
|
|
|
|
|
|
|
@include media-breakpoint-up($breakpoint, $breakpoints) {
|
|
|
|
// Provide basic `.col-{bp}` classes for equal-width flexbox columns
|
|
|
|
.col#{$infix} {
|
2019-09-28 10:13:36 -04:00
|
|
|
flex: 1 0 0%; // Flexbugs #4: https://github.com/philipwalton/flexbugs#flexbug-4
|
2020-02-03 15:02:53 -05:00
|
|
|
}
|
|
|
|
|
2019-12-19 10:15:57 -05:00
|
|
|
.row-cols#{$infix}-auto > * {
|
|
|
|
@include make-col-auto();
|
|
|
|
}
|
|
|
|
|
2020-04-16 13:15:51 -04:00
|
|
|
@if $grid-row-columns > 0 {
|
|
|
|
@for $i from 1 through $grid-row-columns {
|
|
|
|
.row-cols#{$infix}-#{$i} {
|
|
|
|
@include row-cols($i);
|
|
|
|
}
|
2020-02-03 15:02:53 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.col#{$infix}-auto {
|
|
|
|
@include make-col-auto();
|
|
|
|
}
|
|
|
|
|
2020-04-18 05:51:50 -04:00
|
|
|
@if $columns > 0 {
|
|
|
|
@for $i from 1 through $columns {
|
|
|
|
.col#{$infix}-#{$i} {
|
|
|
|
@include make-col($i, $columns);
|
|
|
|
}
|
2020-02-03 15:02:53 -05:00
|
|
|
}
|
|
|
|
|
2020-04-18 05:51:50 -04:00
|
|
|
// `$columns - 1` because offsetting by the width of an entire row isn't possible
|
|
|
|
@for $i from 0 through ($columns - 1) {
|
|
|
|
@if not ($infix == "" and $i == 0) { // Avoid emitting useless .offset-0
|
|
|
|
.offset#{$infix}-#{$i} {
|
|
|
|
@include make-col-offset($i, $columns);
|
|
|
|
}
|
2020-02-03 15:02:53 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-03-30 09:12:36 -04:00
|
|
|
|
|
|
|
// Gutters
|
|
|
|
//
|
|
|
|
// Make use of `.g-*`, `.gx-*` or `.gy-*` utilities to change spacing between the columns.
|
|
|
|
@each $key, $value in $gutters {
|
|
|
|
.g#{$infix}-#{$key},
|
|
|
|
.gx#{$infix}-#{$key} {
|
2020-04-15 12:52:16 -04:00
|
|
|
--bs-gutter-x: #{$value};
|
2020-03-30 09:12:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
.g#{$infix}-#{$key},
|
|
|
|
.gy#{$infix}-#{$key} {
|
2020-04-15 12:52:16 -04:00
|
|
|
--bs-gutter-y: #{$value};
|
2020-03-30 09:12:36 -04:00
|
|
|
}
|
|
|
|
}
|
2020-02-03 15:02:53 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|