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

Commit 577dc6f

Browse files
Optimized grider.scss
1 parent fc20400 commit 577dc6f

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@
66
[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](https://github.com/codeforms/Grider/releases)
77

88
### Features
9-
* Clean code
10-
* Simple enough and Fully customizable (grid number, class names, breakpoints etc.)
9+
* Clean code, Simple enough and Fully customizable (grid number, class names, breakpoints etc.)
1110
* CSS Grid based, no longer Flexbox
1211
* Viewport breakpoints
1312
* Column offsets
1413
* Equal height columns
1514

1615
### TODO
17-
[ ] Fix responsive columns
18-
[ ] Fix offset columns
19-
[x] Remove spaces between columns
20-
[x] Equal height columns
21-
[x] Viewport breakpoints
22-
[x] Customizable
16+
- [ ] Fix offset columns
17+
- [x] Fix responsive columns
18+
- [x] Remove spaces between columns
19+
- [x] Equal height columns
20+
- [x] Viewport breakpoints
21+
- [x] Customizable
2322

2423
[Take a Look](https://codepen.io/underlinewords/pen/pogooob)

grider.scss

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ $row-name : 'row';
1515
$container-name : 'container';
1616
$column-name : 'column';
1717
$offset : 'offset';
18+
$equal : 'equal';
1819

1920
/********************
2021
COLUMN ********************/
@@ -30,11 +31,11 @@ $screen_viewport_lg : 992px;
3031
$screen_viewport_xl : 1260px;
3132

3233
$viewports: (
33-
(xs, $screen_viewport_xs),
34-
(sm, $screen_viewport_sm),
35-
(md, $screen_viewport_md),
36-
(lg, $screen_viewport_lg),
37-
(xl, $screen_viewport_xl)
34+
(xs, $screen_viewport_xs),
35+
(sm, $screen_viewport_sm),
36+
(md, $screen_viewport_md),
37+
(lg, $screen_viewport_lg),
38+
(xl, $screen_viewport_xl)
3839
);
3940

4041
/*** MIXINS ***/
@@ -44,37 +45,37 @@ $viewports: (
4445
}
4546
}
4647

48+
.#{$container-name} {
49+
width: 95%;
50+
margin: 0 auto;
51+
}
4752
.#{$row-name} {
4853
display: grid;
4954
grid-gap: $gutter;
5055
grid-template-columns: repeat($grid, 1fr);
51-
}
52-
[class^="#{$column-name}"] {
53-
height: auto;
54-
padding: $column-padding;
55-
min-height: $column-min-height;
56+
&> [class^="#{$column-name}"] {
57+
height: fit-content;
58+
padding: $column-padding;
59+
min-height: $column-min-height;
60+
}
61+
&.#{$equal} > [class^="#{$column-name}"] {
62+
height: auto;
63+
grid-auto-rows: 1fr;
64+
}
5665
}
5766
@each $label, $breakpoint, $width in $viewports {
5867
@include breakpoints($breakpoint) {
5968
@for $i from 1 through $grid {
69+
$grid-columns: repeat(#{$i}, 1fr);
6070
.#{$column-name}-#{$i} {
6171
grid-column: span #{$i};
62-
grid-template-columns: repeat(#{$i}, 1fr);
63-
}
64-
@for $y from 1 through $grid {
65-
.#{$offset}-#{$label}-#{$y}.#{$column-name}-#{$label}-#{$y} {
66-
grid-column: #{$y} / span #{$y};
67-
grid-template-columns: repeat(#{$y}, 1fr);
68-
}
6972
}
7073
.#{$column-name}-#{$label}-#{$i} {
7174
grid-column-start: span #{$i};
72-
grid-template-columns: repeat(#{$i}, 1fr);
75+
}
76+
.#{$column-name}-#{$label}-#{$i}.#{$offset}-#{$label}-#{$i} {
77+
grid-column: #{$i} / span #{$i};
7378
}
7479
}
75-
.#{$container-name} {
76-
width: 95%;
77-
margin: 0 auto;
78-
}
79-
}
80+
}
8081
}

0 commit comments

Comments
 (0)