@import '../../globals/scss/vars';
@import '../../globals/scss/theme';
@import '../../globals/scss/colors';
@import '../../globals/scss/spacing';
@import '../../globals/scss/helper-mixins';
@import '../../globals/scss/typography';
@import '@carbon/import-once/scss/import-once';
@import 'mixins';

@mixin tags {
  .#{$prefix}--tag {
    @include font-family;
    @include typescale('omega');
    display: inline-flex;
    align-items: center;
    padding: 0 $spacing-xs;
    height: 1.5rem;
    margin: $spacing-3xs;
    border-radius: rem(15px);
    white-space: nowrap;

    &:not(:first-child) {
      margin-left: 0;
    }
    > a {
      text-decoration: none;
      &:hover {
        text-decoration: underline;
      }
    }
  }

  .#{$prefix}--tag--info {
    @include tag-theme($color__brand-01-10, $color__brand-01-60);
  }

  // .#{$prefix}--tag--beta {
  //   @include tag-theme($color__gray-1, $color__navy-gray-4);
  // }

  .#{$prefix}--tag--error {
    @include tag-theme(var(--support-light-01), var(--support-01));
  }

  .#{$prefix}--tag--success {
    @include tag-theme(var(--support-light-02), darken($support-02, 14));
  }

  .#{$prefix}--tag--warning {
    @include tag-theme(var(--support-light-03), darken($support-03, 18));
  }

  .#{$prefix}--tag--wrap {
    white-space: normal;
  }

  // .#{$prefix}--tag--information {
  //   @include tag-theme(var(--support-light-04), $support-04);
  // }

  // Skeleton state
  .#{$prefix}--tag.#{$prefix}--skeleton {
    @include tag-theme($color__gray-1, $color__navy-gray-4);
    width: rem(60px);

    &:after {
      @include skeleton;
      content: '';
      height: rem(6px);
      width: 100%;
    }
  }
}

@mixin tags--x {
  .#{$prefix}--tag {
    @include font-family;
    @include typescale('omega');
    display: inline-flex;
    align-items: center;
    padding: 0 $spacing-xs;
    height: 1.5rem;
    margin: $spacing-2xs;
    border-radius: rem(15px);

    &:not(:first-child) {
      margin-left: 0;
    }

    &[disabled] {
      @include tag-theme--x($ibm-colors__gray--10, $ibm-colors__gray--30);
    }
  }

  .#{$prefix}--tag--basic {
    @include tag-theme--x($ibm-colors__gray--10, $ibm-colors__gray--100);
  }
  /*
  .#{$prefix}--tag--red {
    @include tag-theme--x($ibm-colors__red--10, $ibm-colors__red--60);
  }

  .#{$prefix}--tag--magenta {
    @include tag-theme--x($ibm-colors__magenta--10, $ibm-colors__magenta--60);
  }

  .#{$prefix}--tag--purple {
    @include tag-theme--x($ibm-colors__purple--10, $ibm-colors__purple--60);
  }

  .#{$prefix}--tag--blue {
    @include tag-theme--x($ibm-colors__blue--10, $ibm-colors__blue--60);
  }

  .#{$prefix}--tag--cyan {
    @include tag-theme--x($ibm-colors__cyan--10, $ibm-colors__cyan--60);
  }

  .#{$prefix}--tag--teal {
    @include tag-theme--x($ibm-colors__teal--10, $ibm-colors__teal--60);
  }

  .#{$prefix}--tag--green {
    @include tag-theme--x($ibm-colors__green--10, $ibm-colors__green--60);
  }

  .#{$prefix}--tag--cool-gray {
    @include tag-theme--x($ibm-colors__cool-gray--10, $ibm-colors__cool-gray--100);
  }

  .#{$prefix}--tag--warm-gray {
    @include tag-theme--x($ibm-colors__warm-gray--10, $ibm-colors__warm-gray--100);
  }*/

  // Skeleton state
  .#{$prefix}--tag.#{$prefix}--skeleton {
    @include tag-theme--x($color__gray-1, $color__navy-gray-4);
    width: rem(60px);

    &:after {
      @include skeleton;
      content: '';
      height: rem(6px);
      width: 100%;
    }
  }
}

@include exports('tags') {
  @if feature-flag-enabled('components-x') {
    @include tags--x;
  } @else {
    @include tags;
  }
}
