Добавила подсветку текушего времени
This commit is contained in:
@@ -1,29 +1,17 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.calendar-column-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
|
||||||
.flex.items-center
|
|
||||||
img.avatar-wrapper.mr-2(:src="info.avatar" alt="Team member")
|
|
||||||
span.member-name.font-medium.text-base.mr-6 {{ info.name }}
|
|
||||||
img.icon-wrapper.cursor-pointer(src="@/assets/icons/lock.svg")
|
|
||||||
base-doc-ok-button
|
|
||||||
.body.flex.flex-col
|
.body.flex.flex-col
|
||||||
span.block.time-indicator(v-if="isShownIndicator" :style="indicatorLocation")
|
.time-circle-indicator.-left-6(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")
|
.line.flex.items-center(v-for="hour in hoursArray" :key="hour")
|
||||||
.middle-line
|
.middle-line
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import BaseDocOkButton from "@/components/base/buttons/BaseDocOkButton.vue";
|
|
||||||
export default {
|
export default {
|
||||||
name: "CalendarColumn",
|
name: "CalendarBackground",
|
||||||
components: { BaseDocOkButton },
|
|
||||||
props: {
|
props: {
|
||||||
info: {
|
|
||||||
type: Object,
|
|
||||||
default() {
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
hoursArray: Array,
|
hoursArray: Array,
|
||||||
currentTime: String,
|
currentTime: String,
|
||||||
},
|
},
|
||||||
@@ -33,11 +21,16 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
indicatorLocation() {
|
lineIndicatorLocation() {
|
||||||
return {
|
return {
|
||||||
top: `${this.calculateIndicatorLocation()}px`,
|
top: `${this.calculateIndicatorLocation()}px`,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
circleIndicatorLocation() {
|
||||||
|
return {
|
||||||
|
top: `${this.calculateIndicatorLocation() - 6}px`,
|
||||||
|
};
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
calculateIndicatorLocation() {
|
calculateIndicatorLocation() {
|
||||||
@@ -56,7 +49,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="sass" scoped>
|
<style lang="sass" scoped>
|
||||||
.calendar-column-wrapper
|
.calendar-background-wrapper
|
||||||
width: 100%
|
width: 100%
|
||||||
|
|
||||||
.header
|
.header
|
||||||
@@ -65,21 +58,10 @@ export default {
|
|||||||
.body
|
.body
|
||||||
position: relative
|
position: relative
|
||||||
|
|
||||||
.avatar-wrapper
|
|
||||||
width: 32px
|
|
||||||
height: 32px
|
|
||||||
|
|
||||||
.icon-wrapper
|
|
||||||
width: 24px
|
|
||||||
height: 24px
|
|
||||||
|
|
||||||
.member-name
|
|
||||||
color: var(--font-dark-blue-color)
|
|
||||||
|
|
||||||
.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(2)
|
&:nth-child(3)
|
||||||
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
|
||||||
@@ -89,8 +71,15 @@ export default {
|
|||||||
border-top: 1px dashed var(--border-light-grey-color)
|
border-top: 1px dashed var(--border-light-grey-color)
|
||||||
width: 100%
|
width: 100%
|
||||||
|
|
||||||
.time-indicator
|
.time-line-indicator
|
||||||
width: 100%
|
width: 100%
|
||||||
border-top: 1px solid var(--time-indicator-color)
|
border-top: 1px solid var(--time-indicator-color)
|
||||||
position: absolute
|
position: absolute
|
||||||
|
|
||||||
|
.time-circle-indicator
|
||||||
|
width: 12px
|
||||||
|
height: 12px
|
||||||
|
background-color: var(--time-indicator-color)
|
||||||
|
border-radius: 50%
|
||||||
|
position: absolute
|
||||||
</style>
|
</style>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.calendar-clock-column.flex.flex-col.items-end.gap-y-43.pt-9.pb-12.px-3
|
.calendar-clock-column.flex.flex-col.items-end.gap-y-43.pt-9.pb-12.px-3
|
||||||
span.font-medium.text-base(v-for="hour in hoursArray") {{ hour }}
|
span.font-medium.text-base(v-for="hour in hoursArray" :key="hour" :class="currentHourStyle(hour)") {{ hour }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -8,11 +8,33 @@ export default {
|
|||||||
name: "CalendarClockColumn",
|
name: "CalendarClockColumn",
|
||||||
props: {
|
props: {
|
||||||
hoursArray: Array,
|
hoursArray: Array,
|
||||||
|
currentTime: String,
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
currentHour() {
|
||||||
|
return parseInt(this.currentTime.slice(0, -6), 10);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
currentHourStyle(elem) {
|
||||||
|
if (parseInt(elem.slice(0, 3), 10) === this.currentHour) {
|
||||||
|
return {
|
||||||
|
"current-time": true,
|
||||||
|
"font-bold": true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
"current-time": false,
|
||||||
|
};
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="sass" scoped>
|
<style lang="sass" scoped>
|
||||||
|
.current-time
|
||||||
|
color: var(--time-indicator-color)
|
||||||
|
|
||||||
.calendar-clock-column
|
.calendar-clock-column
|
||||||
width: 80px
|
width: 80px
|
||||||
height: 100%
|
height: 100%
|
||||||
|
|||||||
@@ -6,19 +6,18 @@
|
|||||||
@next-date="nextDate"
|
@next-date="nextDate"
|
||||||
@selected-layout="selectedLayout")
|
@selected-layout="selectedLayout")
|
||||||
.schedule-body.flex
|
.schedule-body.flex
|
||||||
calendar-clock-column(:hoursArray="hoursArray")
|
calendar-clock-column(:hoursArray="hoursArray" :currentTime="currentTime")
|
||||||
calendar-column(:info="columnInfo" :hoursArray="hoursArray" :currentTime="currentTime")
|
calendar-background(:hoursArray="hoursArray" :currentTime="currentTime")
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as moment from "moment/moment";
|
import * as moment from "moment/moment";
|
||||||
import CalendarHeader from "./CalendarHeader.vue";
|
import CalendarHeader from "./CalendarHeader.vue";
|
||||||
import CalendarColumn from "./CalendarColumn.vue";
|
import CalendarBackground from "./CalendarBackground.vue";
|
||||||
import CalendarClockColumn from "./CalendarClockColumn.vue";
|
import CalendarClockColumn from "./CalendarClockColumn.vue";
|
||||||
import teamMemberAvatar from "@/assets/images/team-member.svg";
|
|
||||||
export default {
|
export default {
|
||||||
name: "CalendarSchedule",
|
name: "CalendarSchedule",
|
||||||
components: { CalendarHeader, CalendarColumn, CalendarClockColumn },
|
components: { CalendarHeader, CalendarBackground, CalendarClockColumn },
|
||||||
props: {
|
props: {
|
||||||
currentDate: {
|
currentDate: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -29,22 +28,20 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
columnInfo: {
|
|
||||||
name: "Захарова А.О.",
|
|
||||||
avatar: teamMemberAvatar,
|
|
||||||
},
|
|
||||||
currentTime: "",
|
currentTime: "",
|
||||||
hoursArray: [],
|
hoursArray: [],
|
||||||
timer: null,
|
timer: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
computed: {
|
||||||
hours() {
|
hours() {
|
||||||
return parseInt(this.currentTime.slice(0, -6), 10);
|
return parseInt(this.currentTime.slice(0, -6), 10);
|
||||||
},
|
},
|
||||||
hoursMinutes() {
|
hoursMinutes() {
|
||||||
return this.currentTime.slice(0, -3);
|
return this.currentTime.slice(0, -3);
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
previousDate() {
|
previousDate() {
|
||||||
this.$emit("previous-date");
|
this.$emit("previous-date");
|
||||||
},
|
},
|
||||||
@@ -55,7 +52,7 @@ export default {
|
|||||||
this.$emit("selected-layout", option);
|
this.$emit("selected-layout", option);
|
||||||
},
|
},
|
||||||
startTimer() {
|
startTimer() {
|
||||||
if (this.hours() <= 18 && this.hours() >= 8) {
|
if (this.hours >= 8 && this.hours < 18) {
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
this.changeCurrentTime();
|
this.changeCurrentTime();
|
||||||
this.changeHoursArray();
|
this.changeHoursArray();
|
||||||
@@ -71,15 +68,15 @@ 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.hoursArray.push(this.hoursMinutes());
|
this.hoursArray.push(this.hoursMinutes);
|
||||||
} else this.hoursArray.push(`${i}:00`);
|
} else this.hoursArray.push(`${i}:00`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeHoursArray() {
|
changeHoursArray() {
|
||||||
this.hoursArray = this.hoursArray.map((elem) => {
|
this.hoursArray = this.hoursArray.map((elem) => {
|
||||||
if (parseInt(elem.slice(0, -3), 10) === this.hours()) {
|
if (parseInt(elem.slice(0, -3), 10) === this.hours) {
|
||||||
return this.hoursMinutes();
|
return this.hoursMinutes;
|
||||||
}
|
}
|
||||||
return elem;
|
return elem;
|
||||||
});
|
});
|
||||||
@@ -87,7 +84,7 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
currentTime() {
|
currentTime() {
|
||||||
if (this.hours() >= 18) {
|
if (this.hours >= 18) {
|
||||||
this.stopTimer();
|
this.stopTimer();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -105,6 +102,5 @@ export default {
|
|||||||
|
|
||||||
<style lang="sass" scoped>
|
<style lang="sass" scoped>
|
||||||
.schedule
|
.schedule
|
||||||
width: 100%
|
|
||||||
background-color: var(--default-white)
|
background-color: var(--default-white)
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ module.exports = {
|
|||||||
gap: {
|
gap: {
|
||||||
43: "43px",
|
43: "43px",
|
||||||
},
|
},
|
||||||
|
spacing: {
|
||||||
|
6: "6px",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [],
|
plugins: [],
|
||||||
|
|||||||
Reference in New Issue
Block a user