summaryrefslogtreecommitdiffstats
path: root/src/components/ConfirmationDialog.vue
diff options
context:
space:
mode:
authorgreta <gretadoci@gmail.com>2023-12-28 13:00:13 +0100
committergreta <gretadoci@gmail.com>2024-01-30 17:08:21 +0100
commit3e3fcd8b56d0767e06471bee4f8bcc946b3b521d (patch)
treeb61b6117328d30b61a4daa6afc728147f5b6c4f2 /src/components/ConfirmationDialog.vue
parentf3bdb9af665e0f53478c1e74d9ff0c51104a74be (diff)
Add confirmation dialog before importing contacts
Signed-off-by: greta <gretadoci@gmail.com>
Diffstat (limited to 'src/components/ConfirmationDialog.vue')
-rw-r--r--src/components/ConfirmationDialog.vue73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/components/ConfirmationDialog.vue b/src/components/ConfirmationDialog.vue
new file mode 100644
index 00000000..d42e8f26
--- /dev/null
+++ b/src/components/ConfirmationDialog.vue
@@ -0,0 +1,73 @@
+<template>
+ <NcModal class="confirm-modal" @close="cancel">
+ <div class="confirm-modal">
+ <h2>{{ title }}</h2>
+ <slot />
+ <div class="confirm-modal__buttons">
+ <NcButton type="tertiary" :disabled="disabled" @click="cancel">
+ {{ t('contacts', 'Cancel') }}
+ </NcButton>
+ <NcButton v-if="resolve"
+ :disabled="disabled"
+ type="primary"
+ @click="confirm">
+ {{ confirmText }}
+ </NcButton>
+ </div>
+ </div>
+ </NcModal>
+</template>
+
+<script>
+import { NcButton, NcModal } from '@nextcloud/vue'
+import { translate as t } from '@nextcloud/l10n'
+
+export default {
+ name: 'ConfirmationDialog',
+ components: {
+ NcButton,
+ NcModal,
+ },
+ props: {
+ title: {
+ type: String,
+ required: true,
+ },
+ resolve: {
+ type: Function,
+ required: true,
+ },
+ reject: {
+ type: Function,
+ required: true,
+ },
+ confirmText: {
+ type: String,
+ default: t('contacts', 'Confirm'),
+ },
+ disabled: {
+ type: Boolean,
+ default: undefined,
+ },
+ },
+ methods: {
+ confirm() {
+ this.resolve()
+ },
+ cancel() {
+ this.reject()
+ },
+ },
+}
+</script>
+
+<style lang="scss" scoped>
+.confirm-modal {
+ padding: 20px;
+
+ &__buttons {
+ display: flex;
+ justify-content: space-between;
+ }
+}
+</style>