Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] ✨ Adjust container and add xs size #30996

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 18 additions & 17 deletions scss/_containers.scss
Expand Up @@ -4,18 +4,19 @@

@if $enable-grid-classes {
// Single container class with breakpoint max-widths
.container {
@include make-container();
@include make-container-max-widths();
}

.container,
// 100% wide container at all breakpoints
.container-fluid {
@include make-container();
}

// Responsive containers that are 100% wide until a breakpoint
@each $breakpoint, $container-max-width in $container-max-widths {
// Avoid gaps for length differences
$start: if(length($grid-breakpoints) > length($container-max-widths), 1, 0);

@for $i from 1 through length($container-max-widths) {
$breakpoint: nth(nth($container-max-widths, $i), 1);
$container-max-width: nth(nth($container-max-widths, $i), 2);

.container-#{$breakpoint} {
@extend .container-fluid;
}
Expand All @@ -25,18 +26,18 @@
max-width: $container-max-width;
}

// Extend each breakpoint which is smaller or equal to the current breakpoint
$extend-breakpoint: true;
.container {
@extend %responsive-container-#{$breakpoint};
}

@each $name, $width in $grid-breakpoints {
@if ($extend-breakpoint) {
.container#{breakpoint-infix($name, $grid-breakpoints)} {
@extend %responsive-container-#{$breakpoint};
}
@if ($i != length($container-max-widths)) {
@for $j from $start + $i through length($grid-breakpoints) - 1 {
$name: nth(nth($grid-breakpoints, $j), 1);

// Once the current breakpoint is reached, stop extending
@if ($breakpoint == $name) {
$extend-breakpoint: false;
@if map-get($container-max-widths, $name) {
.container-#{$name} {
@extend %responsive-container-#{$breakpoint};
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions scss/_variables.scss
Expand Up @@ -302,6 +302,7 @@ $grid-breakpoints: (

// scss-docs-start container-max-widths
$container-max-widths: (
xs: 440px,
sm: 540px,
md: 720px,
lg: 960px,
Expand Down
10 changes: 0 additions & 10 deletions scss/mixins/_container.scss
Expand Up @@ -7,13 +7,3 @@
margin-right: auto;
margin-left: auto;
}


// 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;
}
}
}