@import "../../globals.wp";
@import "./segment";

// Windows Segment
// --------------------------------------------------

$segment-button-wp-text-color-activated:       $toolbar-wp-text-color !default;

$segment-button-wp-padding:                    0 6px !default;
$segment-button-wp-height:                     4rem !default;
$segment-button-wp-line-height:                4rem !default;
$segment-button-wp-font-size:                  1.3rem !default;
$segment-button-wp-text-transform:             uppercase !default;
$segment-button-wp-font-weight:                bold !default;
$segment-button-wp-icon-size:                  2.6rem !default;
$segment-button-wp-icon-line-height:           $segment-button-wp-line-height !default;
$segment-button-wp-background-color:           transparent !default;

$segment-button-wp-opacity:                    .5 !default;
$segment-button-wp-opacity-activated:          1 !default;
$segment-button-wp-opacity-disabled:           .3 !default;

$segment-button-wp-buttons-justify-content:    flex-start !default;

ion-segment {
  justify-content: $segment-button-wp-buttons-justify-content;
}

.segment-button {
  padding: $segment-button-wp-padding;

  height: $segment-button-wp-height;

  font-size: $segment-button-wp-font-size;
  font-weight: $segment-button-wp-font-weight;
  line-height: $segment-button-wp-line-height;

  text-transform: $segment-button-wp-text-transform;

  color: $segment-button-wp-text-color-activated;
  background-color: $segment-button-wp-background-color;
  opacity: $segment-button-wp-opacity;

  &.segment-activated {
    opacity: $segment-button-wp-opacity-activated;
  }

  ion-icon {
    font-size: $segment-button-wp-icon-size;
    line-height: $segment-button-wp-icon-line-height;
  }
}

.segment-button-disabled {
  opacity: $segment-button-wp-opacity-disabled;

  pointer-events: none;
}

.toolbar {

  ion-segment {
    margin: 0 auto;
  }
}


// Windows Segment Button Mixin
// --------------------------------------------------

@mixin wp-segment-button($color-name, $color-base) {

  ion-segment[#{$color-name}] .segment-button {
    color: $color-base;

    &.activated,
    &.segment-activated {
      border-color: $color-base;
      color: $color-base;
      opacity: $segment-button-wp-opacity-activated;
    }
  }

}


// Windows Segment Color Generation
// --------------------------------------------------

@each $color-name, $color-base, $color-contrast in get-colors($colors-wp) {
  @include wp-segment-button($color-name, $color-base);
}
