2014-12-02 14:02:35 -08:00
|
|
|
/// Grid system
|
|
|
|
//
|
|
|
|
// Generate semantic grid columns with these mixins.
|
|
|
|
|
2018-12-14 17:30:12 +01:00
|
|
|
@mixin make-container($gutter: $grid-gutter-width) {
|
2017-08-13 14:54:57 -07:00
|
|
|
width: 100%;
|
2018-12-14 17:54:44 +01:00
|
|
|
padding-right: $gutter / 2;
|
|
|
|
padding-left: $gutter / 2;
|
2017-10-03 06:34:56 +03:00
|
|
|
margin-right: auto;
|
|
|
|
margin-left: auto;
|
2014-12-02 14:02:35 -08:00
|
|
|
}
|
|
|
|
|
2018-12-14 17:30:12 +01:00
|
|
|
@mixin make-row($gutter: $grid-gutter-width) {
|
2016-12-21 20:26:17 -08:00
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
2018-12-14 17:54:44 +01:00
|
|
|
margin-right: -$gutter / 2;
|
|
|
|
margin-left: -$gutter / 2;
|
2014-12-02 14:02:35 -08:00
|
|
|
}
|
|
|
|
|
2020-08-05 08:59:14 -07:00
|
|
|
// For each breakpoint, define the maximum width of the container in a media query
|
|
|
|
@mixin make-container-max-widths($max-widths: $container-max-widths, $breakpoints: $grid-breakpoints) {
|
|
|
|
@each $breakpoint, $container-max-width in $max-widths {
|
|
|
|
@include media-breakpoint-up($breakpoint, $breakpoints) {
|
|
|
|
max-width: $container-max-width;
|
|
|
|
}
|
|
|
|
}
|
2020-08-06 17:40:40 +02:00
|
|
|
@include deprecate("The `make-container-max-widths` mixin", "v4.5.2", "v5");
|
2020-08-05 08:59:14 -07:00
|
|
|
}
|
|
|
|
|
2018-12-14 17:30:12 +01:00
|
|
|
@mixin make-col-ready($gutter: $grid-gutter-width) {
|
2014-12-02 14:02:35 -08:00
|
|
|
position: relative;
|
2016-07-23 17:12:43 -07:00
|
|
|
// Prevent columns from becoming too narrow when at smaller grid tiers by
|
|
|
|
// always setting `width: 100%;`. This works because we use `flex` values
|
|
|
|
// later on to override this initial width.
|
2016-12-21 20:26:17 -08:00
|
|
|
width: 100%;
|
2018-12-14 17:54:44 +01:00
|
|
|
padding-right: $gutter / 2;
|
|
|
|
padding-left: $gutter / 2;
|
2016-07-23 17:12:43 -07:00
|
|
|
}
|
|
|
|
|
2016-09-04 21:43:38 -03:00
|
|
|
@mixin make-col($size, $columns: $grid-columns) {
|
2017-05-26 12:41:07 -07:00
|
|
|
flex: 0 0 percentage($size / $columns);
|
|
|
|
// Add a `max-width` to ensure content within each column does not blow out
|
|
|
|
// the width of the column. Applies to IE10+ and Firefox. Chrome and Safari
|
|
|
|
// do not appear to require this.
|
|
|
|
max-width: percentage($size / $columns);
|
2014-12-02 14:02:35 -08:00
|
|
|
}
|
2017-08-14 22:30:44 -07:00
|
|
|
|
2019-10-16 23:46:34 -07:00
|
|
|
@mixin make-col-auto() {
|
|
|
|
flex: 0 0 auto;
|
|
|
|
width: auto;
|
|
|
|
max-width: 100%; // Reset earlier grid tiers
|
|
|
|
}
|
|
|
|
|
2017-08-14 22:30:44 -07:00
|
|
|
@mixin make-col-offset($size, $columns: $grid-columns) {
|
2017-10-03 22:12:31 +03:00
|
|
|
$num: $size / $columns;
|
|
|
|
margin-left: if($num == 0, 0, percentage($num));
|
2017-08-14 22:30:44 -07:00
|
|
|
}
|
2019-07-23 23:00:29 -07: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-09-21 14:47:08 +03:00
|
|
|
> * {
|
2019-08-28 23:37:39 +09:00
|
|
|
flex: 0 0 100% / $count;
|
|
|
|
max-width: 100% / $count;
|
2019-07-23 23:00:29 -07:00
|
|
|
}
|
|
|
|
}
|