Feat: date display

This commit is contained in:
Bertrand Benjamin 2021-08-11 14:54:27 +02:00
parent 9328e2c821
commit 43e29653ba

View File

@ -1,7 +1,12 @@
<template> <template>
<div class="month-presentation"> <div class="month-presentation">
<div class="date"> <div class="date">
{{ TheDate }} <div class="month">
{{ theMonth }}
</div>
<div class="year">
{{ theYear }}
</div>
</div> </div>
<div id="display"> <div id="display">
<ul> <ul>
@ -37,7 +42,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="actions"> <div>
<button class="edit" @click="toggleEdit" v-show="!editing"> Éditer </button> <button class="edit" @click="toggleEdit" v-show="!editing"> Éditer </button>
<button class="validate" @click="save" v-show="editing"> Valider </button> <button class="validate" @click="save" v-show="editing"> Valider </button>
<button class="cancel" @click="cancel" v-show="editing"> Annuler </button> <button class="cancel" @click="cancel" v-show="editing"> Annuler </button>
@ -47,6 +52,7 @@
<script> <script>
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
import { parseISO, format } from 'date-fns'
export default { export default {
name: 'MonthPresentation', name: 'MonthPresentation',
props: { props: {
@ -65,6 +71,15 @@ export default {
this.monthCopy = {...this.TheMonth} this.monthCopy = {...this.TheMonth}
}, },
computed: { computed: {
rawDate: function () {
return parseISO(this.TheDate, "yyyy-MM", new Date())
},
theMonth: function () {
return format(this.rawDate, "MMM", )
},
theYear: function () {
return format(this.rawDate, "YYY", )
},
}, },
methods: { methods: {
...mapActions('travail', { ...mapActions('travail', {
@ -92,9 +107,15 @@ export default {
<!-- Add "scoped" attribute to limit CSS to this component only --> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped> <style scoped>
.month-presentation { .month-presentation {
/*
display: inline-flex; display: inline-flex;
flex-direction: row; flex-direction: row;
background-color: mintcream; */
display: grid;
grid-template-columns: 1fr 6fr 150px;
box-shadow: 2px 2px 5px gray;
border-left: 1rem solid black;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
width: 100%; width: 100%;
@ -105,8 +126,12 @@ export default {
} }
.date { .date {
font-size: 1.5em; font-size: 1em;
font-weight: bold; font-weight: bold;
border-right: 1px solid black;
}
.month{
font-size: 2em;
} }
ul { ul {