Сделала переключатель День/Неделя
This commit is contained in:
@@ -1,38 +1,44 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.calendar-header-wrapper.flex.items-center.justify-between.ml-2.py-3.pl-5.pr-6
|
.calendar-header-wrapper.flex.items-center.justify-between.ml-2.py-3.pl-5.pr-6
|
||||||
.right-side.flex
|
.flex
|
||||||
base-arrow-button.left-arrow.mr-4
|
base-arrow-button.left-arrow.mr-4
|
||||||
base-arrow-button.right-arrow.mr-6
|
base-arrow-button.right-arrow.mr-6
|
||||||
.text.flex.items-center
|
.text.flex.items-center
|
||||||
span.font-medium.text-base 24 Мая 2022
|
span.font-medium.text-base 24 Мая 2022
|
||||||
span.today.font-bold.text-xxs(v-if="isToday") Сегодня
|
span.today.font-bold.text-xxs(v-if="isToday") Сегодня
|
||||||
|
calendar-layout-switch(@selected="changeSelectedLayout")
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import BaseArrowButton from "@/components/base/buttons/BaseArrowButton.vue";
|
import BaseArrowButton from "@/components/base/buttons/BaseArrowButton.vue";
|
||||||
|
import CalendarLayoutSwitch from "./CalendarLayoutSwitch.vue";
|
||||||
export default {
|
export default {
|
||||||
name: "CalendarHeader",
|
name: "CalendarHeader",
|
||||||
components: { BaseArrowButton },
|
components: { BaseArrowButton, CalendarLayoutSwitch },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isToday: true,
|
isToday: true,
|
||||||
|
selectedLayout: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {},
|
methods: {
|
||||||
|
changeSelectedLayout(option) {
|
||||||
|
this.selectedLayout = option;
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="sass">
|
<style lang="sass" scoped>
|
||||||
.calendar-header-wrapper
|
.calendar-header-wrapper
|
||||||
width: 100%
|
width: 100%
|
||||||
background-color: var(--bg-white-color)
|
background-color: var(--bg-white-color)
|
||||||
height: 56px
|
height: 56px
|
||||||
border-radius: 4px
|
border-radius: 4px
|
||||||
|
|
||||||
.right-side
|
|
||||||
|
|
||||||
.left-arrow
|
.left-arrow
|
||||||
transform: rotate(90deg)
|
transform: rotate(90deg)
|
||||||
|
|
||||||
.right-arrow
|
.right-arrow
|
||||||
transform: rotate(270deg)
|
transform: rotate(270deg)
|
||||||
|
|
||||||
|
|||||||
47
src/pages/calendar/components/CalendarLayoutSwitch.vue
Normal file
47
src/pages/calendar/components/CalendarLayoutSwitch.vue
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<template lang="pug">
|
||||||
|
.layout-switch-wrapper.inline-block
|
||||||
|
button#day.py-2.px-3(:class="dayLayoutState" @click="changeSelectedLayout") День
|
||||||
|
button#week.py-2.px-3(:class="weekLayoutState" @click="changeSelectedLayout") Неделя
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "CalendarLayoutSwitch",
|
||||||
|
props: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
selectedLayout: "day",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
dayLayoutState() {
|
||||||
|
return {
|
||||||
|
active: this.selectedLayout === "day",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
weekLayoutState() {
|
||||||
|
return {
|
||||||
|
active: this.selectedLayout === "week",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
changeSelectedLayout(event) {
|
||||||
|
this.selectedLayout = event.target.id;
|
||||||
|
this.$emit("selected", event.target.id);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass" scoped>
|
||||||
|
.active
|
||||||
|
background-color: #6787e7
|
||||||
|
color: var(--bg-white-color)
|
||||||
|
border-radius: 4px
|
||||||
|
|
||||||
|
.layout-switch-wrapper
|
||||||
|
background-color: var(--bg-lavender-color)
|
||||||
|
color: var(--font-dark-blue-color)
|
||||||
|
border-radius: 4px
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user