Skip to content
This repository has been archived by the owner on Oct 22, 2020. It is now read-only.

Commit

Permalink
Optimized grider.scss
Browse files Browse the repository at this point in the history
  • Loading branch information
UnderlineWords committed Jun 7, 2020
1 parent 22a7ac6 commit f33c91b
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions grider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

/*** BASIC ***/
$grid: 16;
$gutter: 4%;

/*** NAMES ***/
$row-name: 'row';
$container-name: 'container';
$column-name: 'col';
$column-name-small: 'sm';
$offset: 'offset';

/*** CONTAINER ***/
$container-width: 97%;
Expand All @@ -24,7 +23,7 @@

/*** COLUMN ***/
$column-width: 100%;
$column-margin: .3rem;
$column-padding: 0;
$column-min-height: .125rem;

/*** BREAKPOINTS ***/
Expand Down Expand Up @@ -61,23 +60,27 @@
width: $row-width;
[class^="#{$column-name}"] {
float: left;
margin: $column-margin;
padding: $column-padding;
min-height: $column-min-height;
flex-grow: 1;
max-width: 100%;
}
@for $i from 1 through $grid {
.#{$column-name}-#{$i} {
width: $column-width;
flex-basis: $column-width;
}
.#{$column-name}-#{$i}-#{$column-name-small} {
width: ($column-width / ($grid / $i)) - ($gutter * ($grid - $i) / $grid);
.#{$column-name}-#{$offset}-#{$i} {
margin-left: 0;
flex-basis: $column-width;
}
}
@include breakpoints($breakpoint-medium) {
@for $i from 1 through $grid {
$value : (100 / ($grid / $i) ) * 1%;
.#{$column-name}-#{$i} {
width: ($column-width / ($grid / $i)) - ($gutter * ($grid - $i) / $grid);
flex-basis: $value;
}
.#{$column-name}-#{$offset}-#{$i} {
flex-basis: $value;
margin-left: $value;
}
}
}
Expand Down

0 comments on commit f33c91b

Please sign in to comment.