@import "settings";
@import "typography";

/// Set to false to not include link styling in the bundle
/// @type Bool
$bonsai-include-links: $bonsai-include-components !default;

/// Sets the color of default links
/// @type Color
$bonsai-link-default: get-color(primary) !default;

/// Sets the color of hover links
/// @type Color
$bonsai-link-hover: get-color(hover) !default;

/// Sets the color of active links
/// @type Color
$bonsai-link-active: get-color(active) !default;

/// Underlines and colors a link with $bonsai-link-default
@mixin link-default {
  color: $bonsai-link-default;
  text-decoration: underline;
}

/// Colors text with $bonsai-link-hover
@mixin link-default-hover {
  color: $bonsai-link-hover;
}

/// Colors text with $bonsai-link-hover
@mixin link-default-focus {
  color: $bonsai-link-hover;
}

/// Colors text with $bonsai-link-active
@mixin link-default-active {
  color: $bonsai-link-active;
}

/// Formats the colors and cursor behavior for a disabled link
@mixin link-disabled {
  color: $bonsai-disabled-text !important;
  cursor: not-allowed !important;
}

/// Colors text with $bonsai-disabled-text
@mixin link-disabled-hover {
  color: $bonsai-disabled-text !important;
}

/// Applies conventional styling for a link
@mixin links {
  @if $bonsai-include-links {
    a,
    .link {
      & {
        @include link-default;
      }

      &:hover {
        @include link-default-hover;
      }

      &:focus {
        @include link-default-focus;
      }

      &:active {
        @include link-default-active;
      }

      &.disabled {
        @include link-disabled;

        &:hover {
          @include link-disabled-hover;
        }
      }
    }

    .no-underline {
      &,
      & a {
        @include no-underline;
      }
    }
  }
}
