amy-d
3/23/2017 - 3:39 PM

Setting up breakpoints

Setting up breakpoints

// Scss
.m-tabs {
  background-color: #f2f2f2;

  @include breakpoint(medium) {
    background-color: #666;
  }
}
$breakpoints: (
  small: 767px,
  medium: 992px,
  large: 1200px
);

// _mixins.scss
@mixin breakpoint($breakpoint) { 
  @if map-has-key($breakpoints, $breakpoint) {
    @media (min-width: #{map-get($breakpoints, $breakpoint)}) {
      @content;
    }
  }

  @else {
    @warn "Unfortunately, no value could be retrieved from `#{$breakpoint}`. "
        + "Please make sure it is defined in `$breakpoints` map.";
  }
}