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

Commit 4a7f8dc

Browse files
Added true/false features and code optimized
1 parent 65efed7 commit 4a7f8dc

File tree

2 files changed

+47
-32
lines changed

2 files changed

+47
-32
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
***Take a look at*** [https://codepen.io/underlinewords/pen/pogooob](https://codepen.io/underlinewords/pen/pogooob)
99

1010
### Features
11-
* Clean code, Simple enough and Fully customizable (grid number, class names, breakpoints etc.)
11+
* Clean code, Simple enough and Fully customizable (grid number, class names, breakpoints, enable/disable features etc.)
1212
* CSS Grid based, no longer Flexbox (since v1.3.0)
1313
* Viewport breakpoints
14-
* Column offsets
15-
* Equal height columns
14+
* ***Optionally*** "Column Offsets" Feature
15+
* ***Optionally*** "Equal Height Columns" Feature
1616

1717
### TODO
1818
- [x] Column Offsets

grider.scss

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,29 @@
44
||||||||||||||||
55
*/
66

7+
/********************
8+
ENABLE / DISABLE FEATURES ********************/
9+
$equal-feature : true;
10+
$offset-feature : true;
11+
712
/********************
813
BASIC ********************/
914
$grid : 16;
1015
$gutter : 6px;
1116

1217
/********************
13-
NAMES ********************/
14-
$row-name : 'row';
15-
$container-name : 'container';
16-
$column-name : 'column';
18+
NAMING ********************/
19+
$row : 'row';
20+
$container : 'container';
21+
$column : 'column';
1722
$offset : 'offset';
1823
$equal : 'equal';
24+
// breakpoints //
25+
$extra-small : 'xs';
26+
$small : 'sm';
27+
$medium : 'md';
28+
$large : 'lg';
29+
$extra-large : 'lg';
1930

2031
/********************
2132
COLUMN ********************/
@@ -24,18 +35,18 @@ $column-min-height : .125rem;
2435

2536
/********************
2637
BREAKPOINTS ********************/
27-
$screen_viewport_xs : 0;
28-
$screen_viewport_sm : 500px;
29-
$screen_viewport_md : 768px;
30-
$screen_viewport_lg : 992px;
31-
$screen_viewport_xl : 1260px;
38+
$breakpoints-extra-small : 0;
39+
$breakpoints-small : 500px;
40+
$breakpoints-medium : 768px;
41+
$breakpoints-large : 992px;
42+
$breakpoints-extra-large : 1260px;
3243

3344
$viewports: (
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)
45+
($extra-small, $breakpoints-extra-small),
46+
($small, $breakpoints-small),
47+
($medium, $breakpoints-medium),
48+
($large, $breakpoints-large),
49+
($extra-large, $breakpoints-extra-large)
3950
);
4051

4152
/*** MIXINS ***/
@@ -45,35 +56,39 @@ $viewports: (
4556
}
4657
}
4758

48-
.#{$container-name} {
59+
.#{$container} {
4960
width: 95%;
5061
margin: 0 auto;
5162
}
52-
.#{$row-name} {
63+
.#{$row} {
5364
display: grid;
5465
grid-gap: $gutter;
5566
grid-template-columns: repeat($grid, 1fr);
56-
&> [class^="#{$column-name}"] {
57-
height: fit-content;
58-
padding: $column-padding;
67+
&> [class^="#{$column}"] {
68+
height: fit-content;
69+
padding: $column-padding;
5970
min-height: $column-min-height;
6071
}
61-
&.#{$equal} > [class^="#{$column-name}"] {
62-
height: auto;
72+
@if $equal-feature {
73+
&.#{$equal} > [class^="#{$column}"] {
74+
height: auto;
75+
}
6376
}
6477
}
6578
@each $label, $breakpoint, $width in $viewports {
6679
@include breakpoints($breakpoint) {
67-
@for $i from 1 through $grid {
68-
.#{$column-name}-#{$i},
69-
.#{$column-name}-#{$label}-#{$i} {
70-
grid-column: span #{$i};
80+
@for $id from 1 through $grid {
81+
.#{$column}-#{$id},
82+
.#{$column}-#{$label}-#{$id} {
83+
grid-column: span #{$id};
7184
}
72-
@for $y from 1 through $grid {
73-
.#{$column-name}-#{$label}-#{$i}.#{$offset}-#{$label}-#{$y} {
74-
grid-column: #{$y} / span #{$i};
85+
@if $offset-feature {
86+
@for $offset-id from 1 through $grid {
87+
.#{$column}-#{$label}-#{$id}.#{$offset}-#{$label}-#{$offset-id} {
88+
grid-column: #{$offset-id} / span #{$id};
89+
}
7590
}
7691
}
7792
}
78-
}
93+
}
7994
}

0 commit comments

Comments
 (0)