Merge pull request #39 from dderbentsov/UC-11

WIP Добавила возможность скрывать индикатор
This commit is contained in:
Daria Golova
2022-10-17 18:58:34 +03:00
committed by GitHub
4 changed files with 37 additions and 7 deletions

View File

@@ -2,6 +2,7 @@
.calendar-container .calendar-container
calendar-schedule( calendar-schedule(
:currentDate="currentDate" :currentDate="currentDate"
:timeInformation="timeInformation"
@previous-date="switchPreviousDate" @previous-date="switchPreviousDate"
@next-date="switchNextDate" @next-date="switchNextDate"
@selected-layout="changeCalendarLayout" @selected-layout="changeCalendarLayout"
@@ -18,6 +19,10 @@ export default {
return { return {
calendarLayout: "", calendarLayout: "",
currentDate: moment(), currentDate: moment(),
timeInformation: {
dayStartTime: "8:00",
dayEndTime: "18:00",
},
}; };
}, },
methods: { methods: {

View File

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

View File

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

View File

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