Skip to content

Commit

Permalink
Allow tablet, desktop breakpoints to be overriden (#357)
Browse files Browse the repository at this point in the history
We are using GOV.UK Frontend Toolkit in the tech docs work we are doing (although it’s currently just vendor’ed in) and need to override the breakpoints used by the `media` mixin so that the behaviour makes sense for our application.

This makes the tablet and desktop breakpoints variables with default values, which can be overriden by e.g. specifying different values in the application’s stylesheet before frontend toolkit is included.
  • Loading branch information
36degrees authored and robinwhittleton committed Dec 12, 2016
1 parent 2448abd commit 2011e77
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions stylesheets/_conditionals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
$is-ie: false !default;
$mobile-ie6: true !default;

$tablet-breakpoint: 641px !default;
$desktop-breakpoint: 769px !default;

@mixin media($size: false, $max-width: false, $min-width: false, $ignore-for-ie: false) {
@if $is-ie and ($ignore-for-ie == false) {
@if $size != mobile {
Expand All @@ -34,15 +37,15 @@ $mobile-ie6: true !default;
}
} @else {
@if $size == desktop {
@media (min-width: 769px){
@media (min-width: $desktop-breakpoint){
@content;
}
} @else if $size == tablet {
@media (min-width: 641px){
@media (min-width: $tablet-breakpoint){
@content;
}
} @else if $size == mobile {
@media (max-width: 640px){
@media (max-width: $tablet-breakpoint - 1px){
@content;
}
} @else if $max-width != false {
Expand Down

0 comments on commit 2011e77

Please sign in to comment.