Start of MailViewModal

This commit is contained in:
Jeffrey Biles
2020-03-18 12:47:10 -07:00
parent e5dcde2311
commit 270747cd98
2 changed files with 69 additions and 3 deletions

View File

@@ -1,7 +1,11 @@
<template> <template>
<table> <table>
<tbody> <tbody>
<tr v-for="email in emails" :key="email.id" :class="[email.read ? 'read' : '']"> <tr v-for="email in emails"
:key="email.id"
:class="[email.read ? 'read' : '']"
@click="openedEmail = email"
class="clickable">
<td> <td>
<input type="checkbox" <input type="checkbox"
:checked="emailSelection.emails.has(email)" :checked="emailSelection.emails.has(email)"
@@ -15,22 +19,31 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<MailViewModal :email="openedEmail" />
</template> </template>
<script> <script>
import { format } from 'date-fns' import { format } from 'date-fns'
import useEmailSelection from '../composition/useEmailSelection'; import useEmailSelection from '../composition/useEmailSelection';
import MailViewModal from '@/components/MailViewModal.vue';
import { ref } from 'vue';
export default { export default {
setup(){ setup({emails}){
let {emailSelection} = useEmailSelection(); let {emailSelection} = useEmailSelection();
return {format, emailSelection,} let openedEmail = ref();
return {format, emailSelection, openedEmail}
}, },
props: { props: {
emails: { emails: {
type: Array, type: Array,
default: [] default: []
} }
},
components: {
MailViewModal
} }
} }
</script> </script>
@@ -61,4 +74,8 @@
td.date { td.date {
width: 120px; width: 120px;
} }
.clickable {
cursor: pointer;
}
</style> </style>

View File

@@ -0,0 +1,49 @@
<template>
<div class="modal" v-if="email">
<div class="overlay"></div>
<div class="modal-card">
From: {{email.from}}<br>
Subject: <strong>{{email.subject}}</strong>
<p>{{email.body}}</p>
</div>
</div>
</template>
<script>
export default {
props: {
email: {
type: Object
},
isOpened: {
type: Boolean,
default: true
}
}
}
</script>
<style scoped>
.modal, .overlay {
width: 100%;
height: 100%;
position: fixed;
left: 0;
top: 0;
}
.overlay {
opacity: 0.5;
background-color: black;
}
.modal-card {
position: relative;
max-width: 80%;
margin: auto;
margin-top: 30px;
padding: 20px;
background-color: white;
min-height: 500px;
z-index: 10;
opacity: 1;
}
</style>