Merge branch 'master' into UC-13
This commit is contained in:
14
package-lock.json
generated
14
package-lock.json
generated
@@ -8,6 +8,7 @@
|
|||||||
"name": "urban-couscous",
|
"name": "urban-couscous",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"moment": "^2.29.4",
|
||||||
"vue": "^3.2.13",
|
"vue": "^3.2.13",
|
||||||
"vue-router": "^4.1.5",
|
"vue-router": "^4.1.5",
|
||||||
"vuex": "^4.0.2"
|
"vuex": "^4.0.2"
|
||||||
@@ -9154,6 +9155,14 @@
|
|||||||
"integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==",
|
"integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/moment": {
|
||||||
|
"version": "2.29.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
|
||||||
|
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/mrmime": {
|
"node_modules/mrmime": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz",
|
||||||
@@ -20965,6 +20974,11 @@
|
|||||||
"integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==",
|
"integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"moment": {
|
||||||
|
"version": "2.29.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
|
||||||
|
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
|
||||||
|
},
|
||||||
"mrmime": {
|
"mrmime": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
"lint": "vue-cli-service lint"
|
"lint": "vue-cli-service lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"moment": "^2.29.4",
|
||||||
"vue": "^3.2.13",
|
"vue": "^3.2.13",
|
||||||
"vue-router": "^4.1.5",
|
"vue-router": "^4.1.5",
|
||||||
"vuex": "^4.0.2"
|
"vuex": "^4.0.2"
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
[class^="icon-"]::before, [class*=" icon-"]::before {
|
[class^="icon-"]::before, [class*=" icon-"]::before {
|
||||||
/* use !important to prevent issues with browser extensions that change fonts */
|
/* use !important to prevent issues with browser extensions that change fonts */
|
||||||
font-family: 'icomoon' !important;
|
font-family: 'icomoon' !important;
|
||||||
speak: never;
|
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-variant: normal;
|
font-variant: normal;
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
\:root
|
\:root
|
||||||
--bg-lavender-color: #E9E9F6
|
--bg-lavender-color: #e9e9f6
|
||||||
--bg-white-color: #F8F8FF
|
--bg-white-color: #f8f8ff
|
||||||
--bg-ligth-blue-color: #E6EAFC
|
--bg-ligth-blue-color: #e6eafc
|
||||||
--font-dark-blue-color: #252850
|
--font-dark-blue-color: #252850
|
||||||
--font-black-color: #090A15
|
--font-black-color: #090a15
|
||||||
--btn-blue-color: #4772F2
|
--btn-blue-color: #4772f2
|
||||||
--font-grey-color: #9294A7
|
--btn-light-blue-color: #c6d2f6
|
||||||
--border-light-grey-color: #9294A7
|
--font-grey-color: #9294a7
|
||||||
|
--border-light-grey-color: #d3d4dc
|
||||||
--default-shadow: 4px 4px 8px rgba(9, 10, 21, 0.1), -4px -4px 8px rgba(9, 10, 21, 0.1)
|
--default-shadow: 4px 4px 8px rgba(9, 10, 21, 0.1), -4px -4px 8px rgba(9, 10, 21, 0.1)
|
||||||
--bg-hover-row-table: rgba(215, 217, 255, 0.25)
|
--bg-hover-row-table: rgba(215, 217, 255, 0.25)
|
||||||
--default-white: #FFFFFF
|
--default-white: #FFFFFF
|
||||||
|
|||||||
24
src/components/base/buttons/BaseArrowButton.vue
Normal file
24
src/components/base/buttons/BaseArrowButton.vue
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<template lang="pug">
|
||||||
|
button.arrow-button.flex.items-center.icon-down-arrow.px-2.pt-px
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "ArrowButton",
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass" scoped>
|
||||||
|
.arrow-button
|
||||||
|
width: 32px
|
||||||
|
height: 32px
|
||||||
|
background: var(--btn-light-blue-color)
|
||||||
|
color: var(--btn-blue-color)
|
||||||
|
border-radius: 50%
|
||||||
|
font-size: 16px
|
||||||
|
&:hover
|
||||||
|
background: #a0b4f0
|
||||||
|
</style>
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
import { createApp } from "vue";
|
import { createApp } from "vue";
|
||||||
import App from "./App.vue";
|
import App from "./App.vue";
|
||||||
import router from "./router";
|
import router from "./router";
|
||||||
|
import moment from "moment";
|
||||||
import "./assets/sass/fonts.sass";
|
import "./assets/sass/fonts.sass";
|
||||||
import "./assets/sass/tailwind.sass";
|
import "./assets/sass/tailwind.sass";
|
||||||
import "./assets/sass/variables.sass";
|
import "./assets/sass/variables.sass";
|
||||||
import "./assets/css/iconfonts.css";
|
import "./assets/css/iconfonts.css";
|
||||||
|
|
||||||
createApp(App).use(router).mount("#app");
|
createApp(App).use(router, moment).mount("#app");
|
||||||
|
|||||||
@@ -1,27 +1,29 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
div {{persons["person"]}}
|
calendar-header(
|
||||||
|
:currentDay="currentDate"
|
||||||
|
@previous-date="switchPreviousDate"
|
||||||
|
@next-date="switchNextDate")
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
/* eslint-disable */
|
import * as moment from "moment/moment";
|
||||||
|
import CalendarHeader from "./components/CalendarHeader.vue";
|
||||||
|
moment.locale("ru");
|
||||||
export default {
|
export default {
|
||||||
name: "TheCalendar",
|
name: "TheCalendar",
|
||||||
|
components: { CalendarHeader },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
persons: { person: "dasda"},
|
currentDate: moment(),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
savePersons(data) {
|
switchPreviousDate() {
|
||||||
console.log(data)
|
this.currentDate = this.currentDate.clone().subtract(1, "day");
|
||||||
this.persons = data
|
|
||||||
},
|
},
|
||||||
|
switchNextDate() {
|
||||||
|
this.currentDate = this.currentDate.clone().add(1, "day");
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
fetch("https://afae35de-056c-4544-96a5-07f01c158778.mock.pstmn.io/urban")
|
|
||||||
.then((res) => res.json())
|
|
||||||
.then((data) => this.savePersons(data))
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
78
src/pages/calendar/components/CalendarHeader.vue
Normal file
78
src/pages/calendar/components/CalendarHeader.vue
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
<template lang="pug">
|
||||||
|
.calendar-header-wrapper.flex.items-center.justify-between.ml-2.py-3.pl-5.pr-6
|
||||||
|
.flex
|
||||||
|
base-arrow-button.left-arrow.mr-4(@click="previousHandler")
|
||||||
|
base-arrow-button.right-arrow.mr-6(@click="nextHandler")
|
||||||
|
.text.flex.items-center
|
||||||
|
span.font-medium.text-base {{ dateString }}
|
||||||
|
span.today.font-bold.text-xxs(v-if="isToday") Сегодня
|
||||||
|
calendar-layout-switch(@selected="changeSelectedLayout")
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import * as moment from "moment/moment";
|
||||||
|
import BaseArrowButton from "@/components/base/buttons/BaseArrowButton.vue";
|
||||||
|
import CalendarLayoutSwitch from "./CalendarLayoutSwitch.vue";
|
||||||
|
export default {
|
||||||
|
name: "CalendarHeader",
|
||||||
|
components: { BaseArrowButton, CalendarLayoutSwitch },
|
||||||
|
props: {
|
||||||
|
currentDay: Object,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isToday: true,
|
||||||
|
selectedLayout: "",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
dateString() {
|
||||||
|
let newStr = this.currentDay.format("D MMMM YYYY");
|
||||||
|
return newStr
|
||||||
|
.split(" ")
|
||||||
|
.map((elem, index) => {
|
||||||
|
if (index === 1) return elem[0].toUpperCase() + elem.slice(1);
|
||||||
|
return elem;
|
||||||
|
})
|
||||||
|
.join(" ");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
changeSelectedLayout(option) {
|
||||||
|
this.selectedLayout = option;
|
||||||
|
},
|
||||||
|
previousHandler() {
|
||||||
|
this.$emit("previous-date");
|
||||||
|
},
|
||||||
|
nextHandler() {
|
||||||
|
this.$emit("next-date");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
currentDay: function () {
|
||||||
|
this.isToday =
|
||||||
|
this.currentDay.format("DD.MM.YYYY") === moment().format("DD.MM.YYYY");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass" scoped>
|
||||||
|
.calendar-header-wrapper
|
||||||
|
width: 100%
|
||||||
|
background-color: var(--bg-white-color)
|
||||||
|
height: 56px
|
||||||
|
border-radius: 4px
|
||||||
|
|
||||||
|
.left-arrow
|
||||||
|
transform: rotate(90deg)
|
||||||
|
|
||||||
|
.right-arrow
|
||||||
|
transform: rotate(270deg)
|
||||||
|
|
||||||
|
.text
|
||||||
|
color: var(--font-dark-blue-color)
|
||||||
|
|
||||||
|
.today
|
||||||
|
opacity: 0.5
|
||||||
|
</style>
|
||||||
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