new grillade in grid layout

This commit is contained in:
Raphael Goetter 2017-08-01 12:33:42 +02:00
parent 7bd7fb9807
commit 838f77cb6d
7 changed files with 587 additions and 888 deletions

View File

@ -1,5 +1,7 @@
# changelog v7.0.0beta (1er août 2017)
- architecture globale revisitée (vendor, config, library, components)
- refonte complète du système de grille (dorénavant basé sur Grid Layout)
- création d'un mixin de grille
- normalize.css v7.0.0
- refonte complète des boutons, avec possibilités de variantes (primary, success, warning, etc.)
- ajout des badges (tags), avec possibilités de variantes (primary, success, warning, etc.)

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
// Responsive breakpoints variables
// Warning : you should use your own values, regardless of the devices
// Best practise : (max-width: ($BP - 1)) and (min-width: $BP)
// Best practise is Mobile First: (max-width: ($BP - 1)) and (min-width: $BP)
$tiny: 480px !default; // or 'em' if you prefer, of course
$small: 576px !default;
@ -9,96 +9,70 @@ $medium: 768px !default;
$large: 992px !default;
$extra-large: 1200px !default;
/* ---------------------------------- */
/* ==Grillade : Simple Grid System */
/* ---------------------------------- */
/* Doc : http://grillade.knacss.com */
// gutter values for grid layouts. Unit can be: %, px, em, rem
$grid-gutters: ( '': 1rem, '-l': 2rem, '-xl': 4rem );
// IEfixing, see
// https://github.com/alsacreations/KNACSS/issues/133;
$iefix: 0.01px;
@media (min-width: $small) {
[class*=" grid-"],
[class^="grid-"] {
display: flex;
flex-direction: row;
flex-wrap: wrap;
/* --------------------------------------- */
/* ==Grillade : ultra light Grid System */
/* --------------------------------------- */
/* Doc : @TODO */
// WARNING: THIS IS NOT A COMPLETE GRID FRAMEWORK, just ultra light Grid System
// if you need complex Grid :
// 1- use vanilla CSS Grid Layout spec (perfect for you)
// 2- use Bootstrap (good luck)
& > * {
box-sizing: border-box;
min-width: 0;
min-height: 0;
}
}
}
// Multi-line grid constructor
// example : .grid-perso { @include grid(12, 3rem); }
@mixin grid($grid-number: 1, $own-gutter: 0) {
& > * {
width: calc(100% / #{$grid-number} - #{$iefix});
}
@each $affix, $size in $grid-gutters {
&.has-gutter#{$affix} {
margin-right: -$size / 2;
margin-left: -$size / 2;
[class*=" grid-"],
[class^="grid-"] {
@media (min-width: $tiny) {
display: grid;
grid-auto-flow: dense;
& > * {
width: calc(100% / #{$grid-number} - #{$size} - #{$iefix});
margin-right: $size / 2;
margin-left: $size / 2;
}
// gutters
@if variable_exists(grid-gutters) {
$gutter: $grid-gutters !global;
}
}
@if ($own-gutter != 0) {
margin-right: -$own-gutter / 2;
margin-left: -$own-gutter / 2;
& > * {
width: calc(100% / #{$grid-number} - #{$own-gutter} - #{$iefix});
margin-right: $own-gutter / 2;
margin-left: $own-gutter / 2;
@else {
$gutter: ( '': 1rem, '-l': 2rem, '-xl': 4rem ) !global;
}
}
}
// Mono-line grid constructor (.grid)
@media (min-width: $small) {
.grid,
.grid--reverse {
display: flex;
& > * {
flex: 1 1 0%;
box-sizing: border-box;
min-width: 0;
min-height: 0;
}
@each $affix, $size in $grid-gutters {
&.has-gutter#{$affix} > * + * {
margin-left: calc(#{$size} - #{$iefix});
@each $affix, $size in $gutter {
&.has-gutter#{$affix} {
grid-gap: $size;
}
}
}
}
// Constructing grids : will be compiled in CSS
@media (min-width: $small) {
@for $i from 2 through 12 {
[class*="grid-#{$i}"] {
@include grid(#{$i}, 0);
// grid constructor (.grid-2 to .grid-12)
@for $i from 2 through 12 {
[class*="grid-#{$i}"] {
grid-template-columns: repeat(#{$i}, 1fr);
}
}
// grid items constructor (.col-2 to .col-12, .row-2 to .row-12)
@for $i from 2 through 12 {
[class*="col-#{$i}"] {
grid-column: auto / span #{$i};
}
[class*="row-#{$i}"] {
grid-row: auto / span #{$i};
}
}
/* intermediate breakpoint */
// -small-X suffix means "X columns when < small screen"
// example : .grid-4-small-2 will be 1 column (< tiny) then 2 columns (< small) then 4 columns
@media (min-width: $tiny) and (max-width: ($small -1)) {
@for $i from 1 through 4{
[class*="grid-"][class*="-small-#{$i}"] {
grid-template-columns: repeat(#{$i}, 1fr);
}
[class*="col-"][class*="-small-#{$i}"] {
grid-column: auto / span #{$i};
}
}
}
// Grid offsets
.push {
margin-left: auto !important;
}
.pull {
margin-right: auto !important;
}
// Grid order
// grid order
.item-first {
order: -1;
}
@ -107,37 +81,16 @@ $iefix: 0.01px;
order: 1;
}
[class*="grid-"][class*="--reverse"] {
flex-direction: row-reverse;
// grid offset
.grid-offset {
visibility: hidden;
}
// sizing individual children
@media (min-width: $small) {
@each $flow, $divider in ("full" "1"), ("one-half" "2"), ("one-third" "3"), ("one-quarter" "4"), ("one-fifth" "5"), ("one-sixth" "6"), ("two-thirds" "3 * 2"), ("three-quarters" "4 * 3"), ("five-sixths" "6 * 5") {
.#{$flow} {
flex: 0 0 auto;
width: calc(100% / #{$divider} - #{$iefix});
}
@each $affix, $size in $grid-gutters {
.has-gutter#{$affix} > .#{$flow} {
width: calc(100% / #{$divider} - #{$size} - #{$iefix});
}
}
}
// spanning all collumns or rows
.col-all {
grid-column: 1 / -1;
}
/* Responsive Small Breakpoint */
// -small-X suffix means "X columns on small-medium screen"
// example : .grid-4-small-2 will be 1 column (tiny and down) then 2 columns (until medium) then 4 columns
@media (min-width: $small) and (max-width: ($medium - 1)) {
@for $i from 1 through 4 {
[class*="-small-#{$i}"] {
& > * {
width: calc(100% / #{$i} - #{$iefix});
}
@each $affix, $size in $grid-gutters {
&.has-gutter#{$affix} > * {
width: calc(100% / #{$i} - #{$size} - #{$iefix});
}
}
}
}
.row-all {
grid-row: 1 / -1;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,14 @@
// Grid Mixin
// arguments are : columns number, gutter, min-breakpoint
// ex. .ingrid { @include grid(4, 1rem, 640px); }
@mixin grid($number:1, $gutter:0, $breakpoint:0) {
@media (min-width: $breakpoint) {
display: grid;
grid-template-columns: repeat($number, 1fr);
grid-gap: $gutter;
}
}
// Additionnal "utility" breakpoints aliases
// ex. @include respond-to("medium-up") {...}
$bp-aliases: (

View File

@ -1,93 +1,67 @@
/* ---------------------------------- */
/* ==Grillade : Simple Grid System */
/* ---------------------------------- */
/* Doc : http://grillade.knacss.com */
// gutter values for grid layouts. Unit can be: %, px, em, rem
$grid-gutters: ( '': 1rem, '-l': 2rem, '-xl': 4rem );
// IEfixing, see
// https://github.com/alsacreations/KNACSS/issues/133;
$iefix: 0.01px;
@media (min-width: $small) {
[class*=" grid-"],
[class^="grid-"] {
display: flex;
flex-direction: row;
flex-wrap: wrap;
/* --------------------------------------- */
/* ==Grillade : ultra light Grid System */
/* --------------------------------------- */
/* Doc : @TODO */
// WARNING: THIS IS NOT A COMPLETE GRID FRAMEWORK, just ultra light Grid System
// if you need complex Grid :
// 1- use vanilla CSS Grid Layout spec (perfect for you)
// 2- use Bootstrap (good luck)
& > * {
box-sizing: border-box;
min-width: 0;
min-height: 0;
}
}
}
// Multi-line grid constructor
// example : .grid-perso { @include grid(12, 3rem); }
@mixin grid($grid-number: 1, $own-gutter: 0) {
& > * {
width: calc(100% / #{$grid-number} - #{$iefix});
}
@each $affix, $size in $grid-gutters {
&.has-gutter#{$affix} {
margin-right: -$size / 2;
margin-left: -$size / 2;
[class*=" grid-"],
[class^="grid-"] {
@media (min-width: $tiny) {
display: grid;
grid-auto-flow: dense;
& > * {
width: calc(100% / #{$grid-number} - #{$size} - #{$iefix});
margin-right: $size / 2;
margin-left: $size / 2;
}
// gutters
@if variable_exists(grid-gutters) {
$gutter: $grid-gutters !global;
}
}
@if ($own-gutter != 0) {
margin-right: -$own-gutter / 2;
margin-left: -$own-gutter / 2;
& > * {
width: calc(100% / #{$grid-number} - #{$own-gutter} - #{$iefix});
margin-right: $own-gutter / 2;
margin-left: $own-gutter / 2;
@else {
$gutter: ( '': 1rem, '-l': 2rem, '-xl': 4rem ) !global;
}
}
}
// Mono-line grid constructor (.grid)
@media (min-width: $small) {
.grid,
.grid--reverse {
display: flex;
& > * {
flex: 1 1 0%;
box-sizing: border-box;
min-width: 0;
min-height: 0;
}
@each $affix, $size in $grid-gutters {
&.has-gutter#{$affix} > * + * {
margin-left: calc(#{$size} - #{$iefix});
@each $affix, $size in $gutter {
&.has-gutter#{$affix} {
grid-gap: $size;
}
}
}
}
// Constructing grids : will be compiled in CSS
@media (min-width: $small) {
@for $i from 2 through 12 {
[class*="grid-#{$i}"] {
@include grid(#{$i}, 0);
// grid constructor (.grid-2 to .grid-12)
@for $i from 2 through 12 {
[class*="grid-#{$i}"] {
grid-template-columns: repeat(#{$i}, 1fr);
}
}
// grid items constructor (.col-2 to .col-12, .row-2 to .row-12)
@for $i from 2 through 12 {
[class*="col-#{$i}"] {
grid-column: auto / span #{$i};
}
[class*="row-#{$i}"] {
grid-row: auto / span #{$i};
}
}
/* intermediate breakpoint */
// -small-X suffix means "X columns when < small screen"
// example : .grid-4-small-2 will be 1 column (< tiny) then 2 columns (< small) then 4 columns
@media (min-width: $tiny) and (max-width: ($small -1)) {
@for $i from 1 through 4{
[class*="grid-"][class*="-small-#{$i}"] {
grid-template-columns: repeat(#{$i}, 1fr);
}
[class*="col-"][class*="-small-#{$i}"] {
grid-column: auto / span #{$i};
}
}
}
// Grid offsets
.push {
margin-left: auto !important;
}
.pull {
margin-right: auto !important;
}
// Grid order
// grid order
.item-first {
order: -1;
}
@ -96,37 +70,16 @@ $iefix: 0.01px;
order: 1;
}
[class*="grid-"][class*="--reverse"] {
flex-direction: row-reverse;
// grid offset
.grid-offset {
visibility: hidden;
}
// sizing individual children
@media (min-width: $small) {
@each $flow, $divider in ("full" "1"), ("one-half" "2"), ("one-third" "3"), ("one-quarter" "4"), ("one-fifth" "5"), ("one-sixth" "6"), ("two-thirds" "3 * 2"), ("three-quarters" "4 * 3"), ("five-sixths" "6 * 5") {
.#{$flow} {
flex: 0 0 auto;
width: calc(100% / #{$divider} - #{$iefix});
}
@each $affix, $size in $grid-gutters {
.has-gutter#{$affix} > .#{$flow} {
width: calc(100% / #{$divider} - #{$size} - #{$iefix});
}
}
}
// spanning all collumns or rows
.col-all {
grid-column: 1 / -1;
}
/* Responsive Small Breakpoint */
// -small-X suffix means "X columns on small-medium screen"
// example : .grid-4-small-2 will be 1 column (tiny and down) then 2 columns (until medium) then 4 columns
@media (min-width: $small) and (max-width: ($medium - 1)) {
@for $i from 1 through 4 {
[class*="-small-#{$i}"] {
& > * {
width: calc(100% / #{$i} - #{$iefix});
}
@each $affix, $size in $grid-gutters {
&.has-gutter#{$affix} > * {
width: calc(100% / #{$i} - #{$size} - #{$iefix});
}
}
}
}
.row-all {
grid-row: 1 / -1;
}