WIP Добавила возможность скрывать индикатор

This commit is contained in:
Daria Golova
2022-10-17 18:55:37 +03:00
parent 399f07ee6e
commit e114754e95
4 changed files with 37 additions and 7 deletions

View File

@@ -2,18 +2,21 @@
.calendar-background-wrapper.flex.flex-col
.header.flex.items-center.justify-between.py-2.px-6
.body.flex.flex-col
.line-wrapper
.line.flex.items-center(v-for="hour in hoursArray" :key="hour")
.middle-line
.time-circle-indicator.-left-6px(v-if="isShownIndicator" :style="circleIndicatorLocation")
span.time-line-indicator.block(v-if="isShownIndicator" :style="lineIndicatorLocation")
.line.flex.items-center(v-for="hour in hoursArray" :key="hour")
.middle-line
</template>
<script>
import * as moment from "moment/moment";
export default {
name: "CalendarBackground",
props: {
hoursArray: Array,
currentTime: String,
currentDate: Object,
},
data() {
return {
@@ -45,6 +48,12 @@ export default {
return result;
},
},
watch: {
currentDate: function () {
this.isShownIndicator =
this.currentDate.format("DD.MM.YYYY") === moment().format("DD.MM.YYYY");
},
},
};
</script>
@@ -61,7 +70,7 @@ export default {
.line
border-bottom: 1px solid var(--border-light-grey-color)
height: 62px
&:nth-child(3)
&:first-child
height: 63px
border-top: 1px solid var(--border-light-grey-color)
&:last-child

View File

@@ -4,20 +4,30 @@
</template>
<script>
import * as moment from "moment/moment";
export default {
name: "CalendarClockColumn",
props: {
hoursArray: Array,
currentTime: String,
currentDate: Object,
},
computed: {
currentHour() {
return parseInt(this.currentTime.slice(0, -6), 10);
},
isCurrentDay() {
return (
this.currentDate.format("DD.MM.YYYY") === moment().format("DD.MM.YYYY")
);
},
},
methods: {
currentHourStyle(elem) {
if (parseInt(elem.slice(0, 3), 10) === this.currentHour) {
if (
parseInt(elem.slice(0, 3), 10) === this.currentHour &&
this.isCurrentDay
) {
return {
"current-time": true,
"font-bold": true,

View File

@@ -6,8 +6,8 @@
@next-date="nextDate"
@selected-layout="selectedLayout")
.schedule-body.flex
calendar-clock-column(:hoursArray="hoursArray" :currentTime="currentTime")
calendar-background(:hoursArray="hoursArray" :currentTime="currentTime")
calendar-clock-column(:hoursArray="hoursArray" :currentTime="currentTime" :currentDate="currentDate")
calendar-background(:hoursArray="hoursArray" :currentTime="currentTime" :currentDate="currentDate")
</template>
<script>
@@ -25,6 +25,12 @@ export default {
return {};
},
},
timeInformation: {
type: Object,
default() {
return {};
},
},
},
data() {
return {
@@ -68,7 +74,7 @@ export default {
},
hoursArrayInitialization() {
for (let i = 8; i <= 18; i++) {
if (i === this.hours) {
if (i === this.hours && this.hours >= 8 && this.hours < 18) {
this.hoursArray.push(this.hoursMinutes);
} else this.hoursArray.push(`${i}:00`);
}