@import '../../styles/_variables.scss';

$type: ('success', 'primary', 'danger', 'default');

@function typeFunction($t) {
  @if $t==success {
    @return $success;
  } @else if $t==primary {
    @return $primary;
  } @else if $t==danger {
    @return $danger;
  }

  @return $primary;
}

.violetCheckBox {
  display: inline-block;

  label {
    display: flex;
    align-items: center;
    cursor: pointer;
  }
}

@each $t in $type {
  .violetCheckBox#{$t} {
    width: 20px;
    height: 20px;
    display: inline-block;
    text-align: center;
    vertical-align: baseline;
    position: relative;
    outline: none;
    border: 1px solid #fff;
    -webkit-tab-highlight-color: rgba(0, 0, 0, 0);
    color: #fff;
    background: #fff;
    margin-right: 5px;
  }

  .violetCheckBox#{$t}:checked + span {
    color: typeFunction($t);
    cursor: pointer;
  }

  .violetCheckBox#{$t}::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    background: transparent;
    width: 100%;
    height: 100%;
    border: 1px;
    color: transparent;
    cursor: pointer;
  }

  .violetCheckBox#{$t}:checked::before {
    content: '\2713';
    background-color: typeFunction($t);
    border: 2px solid typeFunction($t);
    position: absolute;
    // top: 2px;
    // left: 2.5px;
    width: 85%;
    height: 85%;
    color: #ffffff;
    cursor: pointer;
  }

  .violetCheckBox#{$t}.--disabled:checked::before {
    content: '\2713';
    position: absolute;
    top: 2px;
    left: 2.5px;
    width: 70%;
    cursor: pointer;
  }

  .violetCheckBox#{$t}.--disabled:before {
    cursor: not-allowed;
  }

  .violetCheckBox#{$t}.--disabled + span {
    cursor: not-allowed;
    color: gray;
  }
}
