olly 4c10d2bd4c Migrate /-as-division to math.div
If google3 is the source-of-truth for this third_party code (or if this is legacy code that is no longer synced with an external source), just LGTM this CL and Rosie will submit it. If not, you should patch the upstream source of these files, since we will be disabling support for /-as-division in google3 before support is formally removed from the language.

See go/lsc-slash-as-division-deprecation.

Tested:
    TAP found no affected targets. No targets were built or tested.
    http://test/OCL:380056637:BASE:380052721:1623976139468:f2fd2cbd
PiperOrigin-RevId: 380140762
2021-06-21 22:11:14 +01:00

82 lines
1.8 KiB
SCSS

@use 'sass:math';
$grid-columns: 12;
.grid-container {
@include overflow(hidden);
}
.cell {
min-width: 0;
}
@mixin make-cell($columns) {
@if $columns == "auto" {
@include flex(1 1 0);
width: auto;
} @else if $columns == "shrink" {
@include flex(0 0 auto);
width: auto;
} @else if $columns == "stretch" {
@include flex(1);
} @else {
@include flex(none);
width: percentage(math.div($columns, $grid-columns));
}
}
@mixin make-grid-cell($columns, $breakpoint) {
@include media-breakpoint-up($breakpoint) {
.cell--#{breakpoint-infix($breakpoint)}#{$columns} {
@include make-cell($columns);
}
}
}
.grid {
@include flexbox();
@include flex-wrap(wrap);
& > {
@each $breakpoint in map-keys($responsive) {
@for $i from 1 through $grid-columns {
@include make-grid-cell($i, $breakpoint);
}
@include make-grid-cell("auto", $breakpoint);
@include make-grid-cell("shrink", $breakpoint);
@include make-grid-cell("stretch", $breakpoint);
}
}
}
.grid--reverse {
flex-direction: row-reverse;
}
@mixin make-grid() {
$types: ("p");
$directions: ("x", "y", "");
$spacers: (0, 1, 2, 3, 4, 5);
@each $type in $types {
@each $direction in $directions {
@each $spacer in $spacers {
@if $direction == "" {
.grid--#{$type}-#{$spacer} {
@include make-spacing("m", "", $spacer, true);
.cell {
@include make-spacing($type, "", $spacer);
}
}
} @else {
.grid--#{$type}#{$direction}-#{$spacer} {
@include make-spacing("m", $direction, $spacer, true);
.cell {
@include make-spacing($type, $direction, $spacer);
}
}
}
}
}
}
}
@include make-grid();