//  Copyright (c) 2012-2013, Jungwacht Blauring Schweiz. This file is part of
//  hitobito and licensed under the Affero General Public License version 3
//  or later. See the COPYING file at the top-level directory or at
//  https://github.com/hitobito/hitobito.

// Media Queries
// media queries syntax
// pros @Aris_FM
// =================================================================================

@mixin responsive($media, $max: '') {
  @if $max != '' {
    @if $media == mediaLarge {
      @media screen and (min-width:$media-large) and (max-width:$max - 1px) { @content; }
    }
    @else if $media == mediaDesktop {
      @media screen and (min-width:$media-desktop) and (max-width:$max - 1px) { @content; }
    }
    @else if $media == mediaTablet {
      @media screen and (min-width:$media-tablet) and (max-width:$max - 1px) { @content; }
    }
    @else if $media == mediaPhone {
      @media screen and (min-width:$media-phone) and (max-width:$max - 1px) { @content; }
    }
    @else if $media == phone {
      @media screen and (min-width:0) and (max-width:$max - 1px) { @content; }
    }
  } @else {
    @if $media == mediaLarge {
      @media screen and (min-width:$media-large) { @content; }
    }
    @else if $media == mediaDesktop {
      @media screen and (min-width:$media-desktop) { @content; }
    }
    @else if $media == mediaTablet {
      @media screen and (min-width:$media-tablet) { @content; }
    }
    @else if $media == mediaPhone {
      @media screen and (min-width:$media-phone) { @content; }
    }
  }
}

//  How To Use It:
//  .foo {
//    float: left;
//    width: 1000px;
//
//    @include responsive(tablet) {
//      float: none;
//      width: 600px;
//    }
//    @include responsive(tablet) {
//      width: 480px;
//    }
//    @include responsive(smartphone, $tablet) {
//      width: 280px;
//    }
//  }
