summaryrefslogtreecommitdiff
path: root/src/components/_sila/Global/TableDatePicker.vue
blob: 307389a16dad86bde7db0323b69ede1a5986d8eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<template>
  <b-col class="d-flex align-items-center date-picker">
    <span
      :class="{ 'switch-active': timeScale === 'hour' }"
      style="cursor: pointer"
      @click="switchTimeScale('hour')"
      >{{ $t('global.datePicker.lastHour') }}</span
    >
    <span
      :class="{ 'switch-active': timeScale === 'day' }"
      style="cursor: pointer"
      @click="switchTimeScale('day')"
      >{{ $t('global.datePicker.lastDay') }}</span
    >
  </b-col>
</template>

<script>
export default {
  props: {
    timeScale: {
      type: String,
      default: 'hour',
    },
  },

  methods: {
    switchTimeScale(period) {
      this.$emit('changePeriod', period);
    },
  },
};
</script>
<style lang="scss" scoped>
.date-picker {
  height: 48px;
  max-width: 150%;
  width: auto;
  margin: -2rem -1.95rem 0px -2rem;
  padding-left: 2rem;
  @include media-breakpoint-down(md) {
    padding-left: 1rem;
    padding-right: 1rem;
    margin-left: -0.95rem;
  }
  border-bottom: 1px solid $gray-10;
  gap: 24px;
}

.switch-active {
  color: $primary;
  transition: ease-in 0.15s;
}
</style>