-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Saba-Var/feat/note_delete_modal
feat: note delete modal
- Loading branch information
Showing
3 changed files
with
102 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<template> | ||
<div | ||
class="modal p-2" | ||
:class="{ | ||
'is-active': modelValue | ||
}" | ||
> | ||
<div class="modal-background"></div> | ||
<div class="modal-card" ref="deleteModalRef"> | ||
<header class="modal-card-head"> | ||
<p class="modal-card-title">Delete Note</p> | ||
<button class="delete" aria-label="close" @click="closeModalHandler"></button> | ||
</header> | ||
<section class="modal-card-body">Do you really want to delete this note?</section> | ||
<footer class="modal-card-foot field is-grouped is-grouped-right"> | ||
<button class="button is-danger" @click="$emit('deleteNote')">Delete</button> | ||
<button @click="closeModalHandler" class="button">Cancel</button> | ||
</footer> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { onClickOutside, onKeyStroke } from '@vueuse/core' | ||
import { defineEmits, defineProps, ref } from 'vue' | ||
defineProps({ | ||
modelValue: { | ||
default: false, | ||
type: Boolean | ||
} | ||
}) | ||
const emit = defineEmits(['deleteNote', 'update:modelValue']) | ||
const deleteModalRef = ref(null) | ||
const closeModalHandler = () => { | ||
emit('update:modelValue', false) | ||
} | ||
onClickOutside(deleteModalRef, closeModalHandler) | ||
onKeyStroke('Escape', closeModalHandler) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { default as ModalDeleteNote } from './ModalDeleteNote.vue' | ||
export { default as AddEditNote } from './AddEditNote.vue' | ||
export { default as NoteCard } from './NoteCard.vue' |