# ZeenTimeRange

Компонент ZeenTimeRange

# Примеры:

c
по

# props

Название Тип Обязательный По умолчанию Описание
value Array + - Массив в котором будет два числа «от» и «до»
minMax Array + - Массив в котором будет два числа «от» и «до» максимальное и минимальное значение которое можно выбрать

# Source Code - исходный код компонента

<template lang="pug">
  .ft-range
    .ft-range__inputs
      .ft-range__from
        .ft-range__i-label {{ labelFrom }}
        input(
          readonly
          :value="toHHMM(value[0])"
        )
      .ft-range__to
        .ft-range__i-label {{ labelTo }}
        input(
          readonly
          :value="toHHMM(value[1])"
        )
    .ft-range__slider
      //- не удалять
      //- vue-slider(
      //-   :value="value"
      //-   :min="minMax[0]"
      //-   :max="minMax[1]"
      //-   :interval="10"
      //-   :minRange="15"
      //-   :duration="0.3"
      //-   tooltip="none"
      //-   :enableCross="false"
      //-   :height="2"
      //-   @change="setValue"
      //-   v-bind="$attrs"
      //- )

</template>

<script>
import {toHHMM} from './time'

export default {
  name: 'ZeenTimeRange',
  data() {
    return {
      toHHMM,
    }
  },
  props: {
    value: {
      type: Array,
      required: true,
    },
    minMax: {
      type: Array,
      required: true,
    },
    labelFrom: {
      type: String,
      default: 'c',
    },
    labelTo: {
      type: String,
      default: 'по',
    },
  },
  created() {
    this.toHHMM = toHHMM
  },
  methods: {
    setValue(val) {
      this.$emit('onChange', val)
    },
  },
}
</script>

<style>
:root {
  /*Цвета*/
  --time-range-background: var(--input-background-color);
  --slider-range-color: var(--main-color);
}
</style>

<style lang="scss" scoped>
@import 'src/styles/mixins';

.ft-range {
  &__label {
    display: block;
    font-size: 12px;
    line-height: 16px;
    //color: $gray-color;
    margin-bottom: 5px;
  }

  &__inputs {
    display: flex;
    background-color: var(--time-range-background);
    border-radius: 10px 10px 0 0;
  }

  &__from,
  &__to {
    width: 100%;
    min-width: 1px;
    min-height: 0;
    flex: 0 0 50%;
    max-width: 50%;
    display: flex;
    align-items: center;

    input {
      text-align: center;
      -webkit-appearance: none;
      display: block;
      width: 100%;
      padding: 17px 20px 17px 0;
      border-radius: 5px;
      font-size: 14px;
      font-style: normal;
      font-weight: 400;
      line-height: 20px;
      border: 0;
      background: transparent;
      //color: $text-color;
      //transition: color 0.25s $ease;
      &::placeholder {
        //color: $gray-color;
      }

      &:focus,
      &:active {
        //border-color: $main-color;
        outline: none;
      }
    }
  }

  &__from {
    position: relative;

    &::after {
      display: block;
      content: ' ';
      position: absolute;
      top: 0;
      right: -1px;
      width: 2px;
      height: 100%;
      background: var(--main-border-color);
    }
  }

  &__i-label {
    flex: 0 1 auto;
    display: inline-block;
    font-size: 14px;
    line-height: 20px;
    padding-left: 25px;
    //color: $gray-color;
  }

  &__slider {
    margin-top: -8px;
    height: 0;
  }

  &__slider {
    ::v-deep.vue-slider-rail {
      background-color: var(--main-border-color);
    }

    ::v-deep.vue-slider-dot-handle {
      background: var(--slider-range-color);
      box-shadow: none;
      cursor: pointer;
      width: 100%;
      height: 100%;
      border-radius: 50%;
    }

    ::v-deep.vue-slider-process {
      background-color: var(--slider-range-color);
    }
  }
}

@include phones() {
  .ft-range {
    &__slider {
      height: auto;
    }
  }
}
</style>