@import "../../../themes/ionic.globals.wp";

// Windows Segment
// --------------------------------------------------

/// @prop - Background of the segment button
$segment-button-wp-background-color: transparent !default;

/// @prop - Text color of the activated segment button
$segment-button-wp-text-color-activated: $toolbar-wp-text-color !default;

/// @prop - Padding top of the segment button
$segment-button-wp-padding-top: 0 !default;

/// @prop - Padding end of the segment button
$segment-button-wp-padding-end: 6px !default;

/// @prop - Padding bottom of the segment button
$segment-button-wp-padding-bottom: $segment-button-wp-padding-top !default;

/// @prop - Padding start of the segment button
$segment-button-wp-padding-start: $segment-button-wp-padding-end !default;

/// @prop - Height of the segment button
$segment-button-wp-height: 40px !default;

/// @prop - Line height of the segment button
$segment-button-wp-line-height: 40px !default;

/// @prop - Font size of the segment button
$segment-button-wp-font-size: 13px !default;

/// @prop - Text transform of the segment button
$segment-button-wp-text-transform: uppercase !default;

/// @prop - Font weight of the segment button
$segment-button-wp-font-weight: bold !default;

/// @prop - Opacity of the segment button
$segment-button-wp-opacity: 0.5 !default;

/// @prop - Opacity of the activated segment button
$segment-button-wp-opacity-activated: 1 !default;

/// @prop - Opacity of the disabled segment button
$segment-button-wp-opacity-disabled: 0.3 !default;

/// @prop - Size of an icon in the segment button
$segment-button-wp-icon-size: 26px !default;

/// @prop - Line height of an icon in the segment button
$segment-button-wp-icon-line-height: $segment-button-wp-line-height !default;

/// @prop - Position of the buttons in the segment
$segment-button-wp-buttons-justify-content: flex-start !default;

.segment-wp {
  justify-content: $segment-button-wp-buttons-justify-content;
}

.segment-wp .segment-button {
  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;
  color: $segment-button-wp-text-color-activated;
  text-transform: $segment-button-wp-text-transform;
  background-color: $segment-button-wp-background-color;
  opacity: $segment-button-wp-opacity;
  
  @include padding($segment-button-wp-padding-top, $segment-button-wp-padding-end, $segment-button-wp-padding-bottom, $segment-button-wp-padding-start);
  
  &.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-wp.segment-disabled,
.segment-wp .segment-button-disabled {
  pointer-events: none;
  opacity: $segment-button-wp-opacity-disabled;
}

.toolbar {
  .segment-wp {
    @include margin(0, auto);
  }
  
}

// Windows Segment Button Mixin
// --------------------------------------------------

@mixin wp-segment-button($color-name, $color-base) {
  .segment-wp-#{$color-name} .segment-button {
    color: $color-base;
    
    &:active,
    &.segment-activated {
      color: $color-base;
      border-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);
}
