/**
 * @name 	s-clearfix
 * Apply a clearfix on the element.
 * Supported methods:
 * - micro
 * - facebook
 * - float
 * - micro
 *
 * @param 		{String} 		[$method=micro] 		The clearfix method to use
 *
 * @example 	scss
 * .my-cool-element {
 *  \@include s-clearfix();
 * }
 *
 * @author 		Olivier Bossel <olivier.bossel@gmail.com> (https://olivierbossel.com)
 */

// set default clearfix method to overflow
$clearfix-method: overflow !default;
// can be one of: overflow,facebook,micro,stubborn

// create stub classes for each of the four clearfix methods

%clearfix-overflow {
  overflow: hidden;
}

%clearfix-facebook {
  display: table-cell;
  vertical-align: top;
  width: 10000px !important;
}

%clearfix-float {
  float: left;
  width: 100%;
}

%clearfix-micro {
  zoom: 1;
  &:before,
  &:after {
    content: " ";
    display: table;
  }
  &:after {
    clear: both;
  }
}

// extends so the output will be smaller

@mixin s-clearfix($method: $clearfix-method) {
  @if $method !=
    overflow and
    $method !=
    facebook and
    $method !=
    micro and
    $method !=
    float
  {
    @warn "The clearfix method #{$method} is unkown";
    @include s-clearfix(micro);
  } @else {
    @extend %clearfix-#{$method};
  }
}
