2021-06-17 16:15:59 +00:00
|
|
|
// Grid system
|
2014-12-02 22:02:35 +00:00
|
|
|
//
|
|
|
|
// Generate semantic grid columns with these mixins.
|
|
|
|
|
2018-12-14 16:30:12 +00:00
|
|
|
@mixin make-row($gutter: $grid-gutter-width) {
|
Add additional root variables, rename `$variable-prefix` to `$prefix` (#35981)
* Add additional root variables, rename $variable-prefix to $prefix
- Adds new root CSS variables for border-radius, border-width, border-color, and border-style
- Adds new root CSS variables for heading-color, link-colors, code color, and highlight color
- Replaces most instances of Sass variables (for border-radius, border-color, border-style, and border-width) for CSS variables inside _variables.scss
- Updates $mark-padding to be an even pixel number
- Renames $variable-prefix to $prefix throughout
* Bundlewatch
2022-03-13 17:13:09 +00:00
|
|
|
--#{$prefix}gutter-x: #{$gutter};
|
|
|
|
--#{$prefix}gutter-y: 0;
|
2016-12-22 04:26:17 +00:00
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
2021-10-05 15:40:44 +00:00
|
|
|
// TODO: Revisit calc order after https://github.com/react-bootstrap/react-bootstrap/issues/6039 is fixed
|
Add additional root variables, rename `$variable-prefix` to `$prefix` (#35981)
* Add additional root variables, rename $variable-prefix to $prefix
- Adds new root CSS variables for border-radius, border-width, border-color, and border-style
- Adds new root CSS variables for heading-color, link-colors, code color, and highlight color
- Replaces most instances of Sass variables (for border-radius, border-color, border-style, and border-width) for CSS variables inside _variables.scss
- Updates $mark-padding to be an even pixel number
- Renames $variable-prefix to $prefix throughout
* Bundlewatch
2022-03-13 17:13:09 +00:00
|
|
|
margin-top: calc(-1 * var(--#{$prefix}gutter-y)); // stylelint-disable-line function-disallowed-list
|
|
|
|
margin-right: calc(-.5 * var(--#{$prefix}gutter-x)); // stylelint-disable-line function-disallowed-list
|
|
|
|
margin-left: calc(-.5 * var(--#{$prefix}gutter-x)); // stylelint-disable-line function-disallowed-list
|
2014-12-02 22:02:35 +00:00
|
|
|
}
|
|
|
|
|
2021-11-01 06:59:21 +00:00
|
|
|
@mixin make-col-ready() {
|
2019-12-14 11:45:26 +00: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-24 00:12:43 +00:00
|
|
|
// Prevent columns from becoming too narrow when at smaller grid tiers by
|
2019-09-28 14:13:36 +00:00
|
|
|
// always setting `width: 100%;`. This works because we set the width
|
2016-07-24 00:12:43 +00:00
|
|
|
// later on to override this initial width.
|
2019-09-28 14:13:36 +00:00
|
|
|
flex-shrink: 0;
|
2016-12-22 04:26:17 +00:00
|
|
|
width: 100%;
|
2019-09-28 14:13:36 +00:00
|
|
|
max-width: 100%; // Prevent `.col-auto`, `.col` (& responsive variants) from breaking out the grid
|
Add additional root variables, rename `$variable-prefix` to `$prefix` (#35981)
* Add additional root variables, rename $variable-prefix to $prefix
- Adds new root CSS variables for border-radius, border-width, border-color, and border-style
- Adds new root CSS variables for heading-color, link-colors, code color, and highlight color
- Replaces most instances of Sass variables (for border-radius, border-color, border-style, and border-width) for CSS variables inside _variables.scss
- Updates $mark-padding to be an even pixel number
- Renames $variable-prefix to $prefix throughout
* Bundlewatch
2022-03-13 17:13:09 +00:00
|
|
|
padding-right: calc(var(--#{$prefix}gutter-x) * .5); // stylelint-disable-line function-disallowed-list
|
|
|
|
padding-left: calc(var(--#{$prefix}gutter-x) * .5); // stylelint-disable-line function-disallowed-list
|
|
|
|
margin-top: var(--#{$prefix}gutter-y);
|
2016-07-24 00:12:43 +00:00
|
|
|
}
|
|
|
|
|
2021-04-06 18:45:28 +00:00
|
|
|
@mixin make-col($size: false, $columns: $grid-columns) {
|
|
|
|
@if $size {
|
|
|
|
flex: 0 0 auto;
|
2021-06-22 17:39:13 +00:00
|
|
|
width: percentage(divide($size, $columns));
|
2021-06-14 16:35:30 +00:00
|
|
|
|
2021-04-06 18:45:28 +00:00
|
|
|
} @else {
|
|
|
|
flex: 1 1 0;
|
|
|
|
max-width: 100%;
|
|
|
|
}
|
2014-12-02 22:02:35 +00:00
|
|
|
}
|
2017-08-15 05:30:44 +00:00
|
|
|
|
2019-10-17 06:46:34 +00:00
|
|
|
@mixin make-col-auto() {
|
|
|
|
flex: 0 0 auto;
|
|
|
|
width: auto;
|
|
|
|
}
|
|
|
|
|
2017-08-15 05:30:44 +00:00
|
|
|
@mixin make-col-offset($size, $columns: $grid-columns) {
|
2021-06-22 17:39:13 +00:00
|
|
|
$num: divide($size, $columns);
|
2017-10-03 19:12:31 +00:00
|
|
|
margin-left: if($num == 0, 0, percentage($num));
|
2017-08-15 05:30:44 +00:00
|
|
|
}
|
2019-07-24 06:00:29 +00: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 13:55:23 +00:00
|
|
|
> * {
|
2019-09-28 14:13:36 +00:00
|
|
|
flex: 0 0 auto;
|
2021-06-17 16:15:59 +00:00
|
|
|
width: divide(100%, $count);
|
2019-07-24 06:00:29 +00:00
|
|
|
}
|
|
|
|
}
|
2020-02-03 20:02:53 +00: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);
|
2021-07-29 03:29:46 +00:00
|
|
|
|
2020-02-03 20:02:53 +00:00
|
|
|
@include media-breakpoint-up($breakpoint, $breakpoints) {
|
|
|
|
// Provide basic `.col-{bp}` classes for equal-width flexbox columns
|
|
|
|
.col#{$infix} {
|
2019-09-28 14:13:36 +00:00
|
|
|
flex: 1 0 0%; // Flexbugs #4: https://github.com/philipwalton/flexbugs#flexbug-4
|
2020-02-03 20:02:53 +00:00
|
|
|
}
|
|
|
|
|
2019-12-19 15:15:57 +00:00
|
|
|
.row-cols#{$infix}-auto > * {
|
|
|
|
@include make-col-auto();
|
|
|
|
}
|
|
|
|
|
2020-04-16 17:15:51 +00: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 20:02:53 +00:00
|
|
|
}
|
|
|
|
}
|
2021-06-03 16:18:00 +00:00
|
|
|
|
2020-02-03 20:02:53 +00:00
|
|
|
.col#{$infix}-auto {
|
|
|
|
@include make-col-auto();
|
|
|
|
}
|
|
|
|
|
2020-04-18 09:51:50 +00:00
|
|
|
@if $columns > 0 {
|
|
|
|
@for $i from 1 through $columns {
|
|
|
|
.col#{$infix}-#{$i} {
|
|
|
|
@include make-col($i, $columns);
|
|
|
|
}
|
2020-02-03 20:02:53 +00:00
|
|
|
}
|
|
|
|
|
2020-04-18 09:51:50 +00: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 20:02:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-03-30 13:12:36 +00: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} {
|
Add additional root variables, rename `$variable-prefix` to `$prefix` (#35981)
* Add additional root variables, rename $variable-prefix to $prefix
- Adds new root CSS variables for border-radius, border-width, border-color, and border-style
- Adds new root CSS variables for heading-color, link-colors, code color, and highlight color
- Replaces most instances of Sass variables (for border-radius, border-color, border-style, and border-width) for CSS variables inside _variables.scss
- Updates $mark-padding to be an even pixel number
- Renames $variable-prefix to $prefix throughout
* Bundlewatch
2022-03-13 17:13:09 +00:00
|
|
|
--#{$prefix}gutter-x: #{$value};
|
2020-03-30 13:12:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.g#{$infix}-#{$key},
|
|
|
|
.gy#{$infix}-#{$key} {
|
Add additional root variables, rename `$variable-prefix` to `$prefix` (#35981)
* Add additional root variables, rename $variable-prefix to $prefix
- Adds new root CSS variables for border-radius, border-width, border-color, and border-style
- Adds new root CSS variables for heading-color, link-colors, code color, and highlight color
- Replaces most instances of Sass variables (for border-radius, border-color, border-style, and border-width) for CSS variables inside _variables.scss
- Updates $mark-padding to be an even pixel number
- Renames $variable-prefix to $prefix throughout
* Bundlewatch
2022-03-13 17:13:09 +00:00
|
|
|
--#{$prefix}gutter-y: #{$value};
|
2020-03-30 13:12:36 +00:00
|
|
|
}
|
|
|
|
}
|
2020-02-03 20:02:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-07-26 15:45:10 +00:00
|
|
|
|
|
|
|
@mixin make-cssgrid($columns: $grid-columns, $breakpoints: $grid-breakpoints) {
|
|
|
|
@each $breakpoint in map-keys($breakpoints) {
|
|
|
|
$infix: breakpoint-infix($breakpoint, $breakpoints);
|
|
|
|
|
|
|
|
@include media-breakpoint-up($breakpoint, $breakpoints) {
|
|
|
|
@if $columns > 0 {
|
|
|
|
@for $i from 1 through $columns {
|
|
|
|
.g-col#{$infix}-#{$i} {
|
|
|
|
grid-column: auto / span $i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Start with `1` because `0` is and invalid value.
|
|
|
|
// Ends with `$columns - 1` because offsetting by the width of an entire row isn't possible.
|
|
|
|
@for $i from 1 through ($columns - 1) {
|
|
|
|
.g-start#{$infix}-#{$i} {
|
|
|
|
grid-column-start: $i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|