mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-22 23:25:26 +00:00
Bare app - remove everything except styling, db.json, and packages
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
<template>
|
||||
<div class="bulk-action-bar">
|
||||
<span class="checkbox">
|
||||
<input type="checkbox" :checked="allAreSelected" @click="bulkSelect">
|
||||
<span v-if="!allAreSelected && numberSelected > 0">-</span> <!-- later on this minus sign will be in the checkbox, as it is in gmail -->
|
||||
</span>
|
||||
|
||||
<span class="buttons">
|
||||
<button @click="emailSelection.markRead()"
|
||||
:disabled="Array.from(emailSelection.emails).every(e => e.read)"
|
||||
v-if="actions.includes('markRead')">
|
||||
Mark Read
|
||||
</button>
|
||||
<button @click="emailSelection.markUnread()"
|
||||
:disabled="Array.from(emailSelection.emails).every(e => !e.read)"
|
||||
v-if="actions.includes('markUnread')">
|
||||
Mark Unread
|
||||
</button>
|
||||
<button @click="emailSelection.archive()"
|
||||
:disabled="numberSelected == 0"
|
||||
v-if="actions.includes('archive')">
|
||||
Archive
|
||||
</button>
|
||||
<button @click="emailSelection.moveToInbox()"
|
||||
:disabled="numberSelected == 0"
|
||||
v-if="actions.includes('moveToInbox')">
|
||||
Move to Inbox
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import useEmailSelection from '../composition/useEmailSelection';
|
||||
import { computed } from 'vue';
|
||||
|
||||
export default {
|
||||
setup({emails}){
|
||||
let {emailSelection} = useEmailSelection();
|
||||
let numberSelected = computed(() => {
|
||||
return emailSelection.emails.size;
|
||||
})
|
||||
let allAreSelected = computed(() => {
|
||||
return emails.length == numberSelected.value;
|
||||
})
|
||||
|
||||
let bulkSelect = function(){
|
||||
if(allAreSelected.value) {
|
||||
emailSelection.clear();
|
||||
} else {
|
||||
emailSelection.addMultiple(emails)
|
||||
}
|
||||
}
|
||||
return { emailSelection, allAreSelected, bulkSelect, numberSelected }
|
||||
},
|
||||
props: {
|
||||
emails: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
actions: {
|
||||
type: Array,
|
||||
default: ['markRead', 'markUnread']
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user