mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-23 07:31:26 +00:00
Start of MailViewModal
This commit is contained in:
@@ -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>
|
||||||
49
src/components/MailViewModal.vue
Normal file
49
src/components/MailViewModal.vue
Normal 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>
|
||||||
Reference in New Issue
Block a user