@import "../../themes/ionic.globals";

// Refresher
// --------------------------------------------------

/// @prop - Height of the refresher
$refresher-height:             60px !default;

/// @prop - Color of the refresher icon
$refresher-icon-color:         #000 !default;

/// @prop - Font size of the refresher icon
$refresher-icon-font-size:     30px !default;

/// @prop - Text color of the refresher content
$refresher-text-color:         #000 !default;

/// @prop - Font size of the refresher content
$refresher-text-font-size:     16px !default;

/// @prop - Border color of the refresher
$refresher-border-color:       #ddd !default;


ion-refresher {
  @include position(0, null, null, 0);

  position: absolute;

  z-index: $z-index-refresher;

  display: none;

  width: 100%;
  height: $refresher-height;

  &.refresher-active {
    display: block;
  }
}

.has-refresher > .scroll-content {
  // when the refresher is let go or has completed
  // this transition is what is used to put the
  // scroll content back into it's original location
  @include margin(-1px, null, null, null);

  border-top: 1px solid $refresher-border-color;
  transition: transform 320ms cubic-bezier(.36, .66, .04, 1);
}


// Refresher Content
// --------------------------------------------------

ion-refresher-content {
  display: flex;

  flex-direction: column;
  justify-content: center;

  height: 100%;
}

.refresher-pulling,
.refresher-refreshing {
  display: none;

  width: 100%;
}

.refresher-pulling-icon,
.refresher-refreshing-icon {
  @include text-align(center);
  @include transform-origin(center);

  font-size: $refresher-icon-font-size;
  color: $refresher-icon-color;
  transition: 200ms;
}

.refresher-pulling-text,
.refresher-refreshing-text {
  @include text-align(center);

  font-size: $refresher-text-font-size;
  color: $refresher-text-color;
}

.refresher-refreshing .spinner-ios line,
.refresher-refreshing .spinner-ios-small line,
.refresher-refreshing .spinner-crescent circle {
  stroke: $refresher-icon-color;
}

.refresher-refreshing .spinner-bubbles circle,
.refresher-refreshing .spinner-circles circle,
.refresher-refreshing .spinner-dots circle {
  fill: $refresher-icon-color;
}


// Refresher Content States
// --------------------------------------------------

ion-refresher-content[state=pulling] {
  .refresher-pulling {
    display: block;
  }
}

ion-refresher-content[state=ready] {
  .refresher-pulling {
    display: block;
  }

  .refresher-pulling-icon {
    transform: rotate(180deg);
  }
}

ion-refresher-content[state=refreshing] {
  .refresher-refreshing {
    display: block;
  }
}

ion-refresher-content[state=cancelling] {
  .refresher-pulling {
    display: block;
  }

  .refresher-pulling-icon {
    transform: scale(0);
  }
}

ion-refresher-content[state=completing] {
  .refresher-refreshing {
    display: block;
  }

  .refresher-refreshing-icon {
    transform: scale(0);
  }
}
