@mixin b ($block) {
  @if $block {
    $B: $namespace + '-' + $block !global;
  }
  .#{$B} {
    @content;
  }
}

@mixin clearfix ($side: before) {
  &::#{$side} {
    content: '';
    clear: both;
    display: table;
  }
}

@mixin multi-ellipsis($lines) {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: $lines;
  -webkit-box-orient: vertical;
}

@mixin ellipsis {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@mixin child-center($origin: row) {
  display: flex;
  flex-direction: $origin;
  justify-content: center;
  align-items: center;
}

@mixin self-center($position: fixed) {
  position: $position;
  top: 50%;
  left: 50%;
  transform: translate3d(-50%,-50%,0);
}

@mixin flex-x($justify: flex-start) {
  display: flex;
  justify-content: $justify;
  align-items: center;
}

/* 分割线 */
@mixin border($position: before, $top: auto, $bottom: auto, $left: 15px, $z-index: 1, $borderColor: $border-color) {
  &::#{$position} {
    content: '';
    z-index: $z-index;
    position: absolute;
    pointer-events: none;
    top: $top;
    right: 0;
    bottom: $bottom;
    left: $left;
    border-bottom: 1px solid $borderColor;
    box-sizing: border-box;
    -webkit-transform: scaleY(.5);
    transform: scaleY(.5);
  }
}

/* 背景图 */
@mixin background-img($width: 0, $height: 0, $position: center, $size: cover) {
  flex-shrink: 0;
  width: $width;
  height: $height;
  margin-right: 15px;
  background-position: $position;
  background-size: $size;
  background-repeat: no-repeat;
}

/* 点击白色块的视觉效果 */
@mixin click-feed-back($bg-color: $white) {
  cursor: pointer;
  &:active {
    background-color: darken($bg-color,5);
  }
}

/* 点击链接的视觉效果 */
@mixin link-feed-back($color: $primary-color) {
  &:active {
    color: darken($color,20);
  }
  &:visited {
    color: $color;
  }
}
