-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Black Mirror
committed
Mar 27, 2018
1 parent
d8aa3d1
commit 9275b3b
Showing
6 changed files
with
168 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
@import 'variables'; | ||
@import '~bourbon/app/assets/stylesheets/bourbon'; | ||
@import 'core'; | ||
@import 'grid-system/grid-system'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
@mixin container-breakpoints($breakpoints: $common-breakpoints, $gutter: $gutter-default) { | ||
@each $key, $breakpoint in $breakpoints { | ||
@include media($breakpoint) { | ||
.container { | ||
@include box-size(($breakpoint - $gutter) auto); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@mixin columns-sizes($columns: $columns-default, $gutter: $gutter-default, $key: '') { | ||
@for $i from 0 through $columns { | ||
@if ($i==0) { | ||
.col-#{$key}-push-0 { | ||
left: auto; | ||
} | ||
|
||
.col-#{$key}-pull-0 { | ||
right: auto; | ||
} | ||
} | ||
@else { | ||
$col-percentage: percentage($i / $columns); | ||
|
||
.col-#{$key}-#{$i} { | ||
width: $col-percentage; | ||
} | ||
|
||
.col-#{$key}-push-#{$i} { | ||
left: $col-percentage; | ||
} | ||
|
||
.col-#{$key}-pull-#{$i} { | ||
right: $col-percentage; | ||
} | ||
|
||
.col-#{$key}-offset-#{$i} { | ||
margin-left: $col-percentage; | ||
} | ||
} | ||
} | ||
} | ||
|
||
@mixin columns-breakpoints($breakpoints: $columns-breakpoints, $columns: $columns-default, $gutter: $gutter-default) { | ||
@each $key, $breakpoint in $breakpoints { | ||
@if ($breakpoint==$first-breakpoint) { | ||
@include columns-sizes($columns, $gutter, $key); | ||
} | ||
@else { | ||
@include media($breakpoint) { | ||
@include columns-sizes($columns, $gutter, $key); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@mixin columns($columns: $columns-default, $gutter: $gutter-default) { | ||
// Columns | ||
// | ||
// Common styles for small and large grid columns | ||
$columns-selectors: (); | ||
|
||
@for $i from 1 through $columns { | ||
$columns-selectors: array-concat($columns-selectors, '[class*=\'col-\'][class*=\'-#{$i}\']'); | ||
} | ||
|
||
#{array-join($columns-selectors)} { | ||
@include position(relative); | ||
@include display(inline-block); | ||
@include padding(null $column-padding-right null $column-padding-right); | ||
@include reset-inline-block; | ||
|
||
min-height: 1px; // Prevent columns from collapsing when empty | ||
} | ||
|
||
@include columns-breakpoints($columns-breakpoints, $columns, $gutter) | ||
} | ||
|
||
@mixin grid-system($columns: $columns-default, $gutter: $gutter-default) { | ||
// Grid system | ||
// -------------------------------------------------- | ||
$row-margin-left: ceil(($gutter / -2)); | ||
$row-margin-right: floor(($gutter / -2)); | ||
|
||
$column-padding-left: ceil(($gutter / 2)); | ||
$column-padding-right: floor(($gutter / 2)); | ||
|
||
%container-base { | ||
// container-base | ||
@include display(block); | ||
@include box-size(100% auto); | ||
@include padding(0 $column-padding-right 0 $column-padding-left); | ||
@include margin(0 auto); | ||
} | ||
|
||
[class*='container'] { | ||
// Container widths | ||
// | ||
// Set the container width, and override it for fixed navbars in media queries. | ||
@extend %container-base; | ||
|
||
+ [class*='container'] { | ||
@include margin($gutter null null null); | ||
} | ||
|
||
&:not([class*='-fluid']) { | ||
@include container-breakpoints($common-breakpoints, $gutter); | ||
} | ||
} | ||
|
||
.row { | ||
// Row | ||
// | ||
// Rows contain and clear the floats of your columns. | ||
@include display(block); | ||
@include margin(0 $row-margin-right 0 $row-margin-left); | ||
|
||
+ .row { | ||
@include margin($gutter null null null); | ||
} | ||
} | ||
|
||
@include columns($columns, $gutter); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,5 @@ | ||
$breakpoints: (phone: 400px, phone-wide: 480px, phablet: 560px, tablet-small: 640px, tablet: 768px, tablet-wide: 1024px, desktop: 1248px, desktop-wide: 1440px); | ||
|
||
@mixin media($width, $type: min) { | ||
@if map_has_key($breakpoints, $width) { | ||
$width: map_get($breakpoints, $width); | ||
|
||
@if $type == max { | ||
$width: $width - 1px; | ||
} | ||
|
||
@media only screen and (#{$type}-width: $width) { | ||
@content; | ||
} | ||
@media screen and (#{$type}-width: $width) { | ||
@content; | ||
} | ||
} | ||
|
||
// example | ||
// .site-header { | ||
// padding: 2rem; | ||
// font-size: 1.8rem; | ||
// @include mq('tablet-wide') { | ||
// padding-top: 4rem; | ||
// font-size: 2.4rem; | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,24 @@ | ||
$output-bourbon-deprecation-warnings: false !default; | ||
|
||
$columns-default: 12 !default; // grid-system columns default number | ||
|
||
$gutter-default: 1.5rem !default; // grid-system grid gutter default number | ||
|
||
$common-breakpoints: ( | ||
sm: 768px, // small devices | ||
md: 992px, // medium devices | ||
lg: 1200px, // large devices | ||
xl: 1600px, // extra large devices | ||
fhd: 1920px, // full HD devices | ||
qhd: 2560px, // quad HD (2k) devices | ||
uhd: 3840px // ultra HD (4k) devices | ||
) !default; // common-breakpoints used as default for container breakpoints | ||
|
||
$first-column-breakpoint: 320px !default; //first column breakpoint used as default without media queries | ||
|
||
$columns-breakpoints: array-concat(( | ||
sp: $first-column-breakpoint, // common smartphones | ||
ip: 375px, // iphone (since iphone5) | ||
ipp: 414px, // iphone plus (since iphone5) | ||
xs: 576px // extra small devices | ||
), $common-breakpoints) !default; // columns-breakpoints used for media queries and column classes sizes & positions |