@import "../mixins/mixins";

/* Link
--------------------------*/
/// fontSize||Font|1
$--link-font-size:14px !default;
/// fontWeight||Font|1
$--link-font-weight: 500 !default;
/// color||Color|0
$--link-default-font-color: #606266 !default;
/// color||Color|0
$--link-default-active-color: #409EFF !default;
/// color||Color|0
$--link-disabled-font-color: #C0C4CC !default;
/// color||Color|0
$--link-primary-font-color:  #409EFF !default;
/// color||Color|0
$--link-success-font-color: #67C23A  !default;
/// color||Color|0
$--link-warning-font-color: #E6A23C !default;
/// color||Color|0
$--link-danger-font-color: #F56C6C !default;
/// color||Color|0
$--link-info-font-color: #909399 !default;

$--color-white: #FFFFFF !default;

$typeMap: (
  primary: $--link-primary-font-color, 
  danger: $--link-danger-font-color, 
  success: $--link-success-font-color, 
  warning: $--link-warning-font-color, 
  info: $--link-info-font-color);

@include b(link) {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  position: relative;
  text-decoration: none;
  outline: none;
  cursor: pointer;
  padding: 0;
  font-size: $--link-font-size;
  font-weight: $--link-font-weight;

  @include when(underline) {
    &:hover:after {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      height: 0;
      bottom: 0;
      border-bottom: 1px solid $--link-default-active-color
    }
  }

  @include when(disabled) {
    cursor: not-allowed;
  } 

  & [class*="ibps-icon-"] {
    & + span {
      margin-left: 5px;
    }
  }
    
    
  &.ibps-link--default  {
    color: $--link-default-font-color;
    &:hover {
      color: $--link-default-active-color
    }
    &:after {
      border-color: $--link-default-active-color
    }
    @include when(disabled) {
      color: $--link-disabled-font-color
    }
  }

  @each $type, $primaryColor in $typeMap {
    &.ibps-link--#{$type} {
      color: $primaryColor;
      &:hover {
        color: mix($primaryColor, $--color-white, 80%)
      }
      &:after {
        border-color: $primaryColor
      }
      @include when(disabled) {
        color: mix($primaryColor, $--color-white, 50%)
      }
      @include when(underline) {
        &:hover:after {
          border-color: $primaryColor
        }
      }
    }
  }
    
}
