pleroma-fe/src/components/confirm_modal/confirm_modal.js

45 lines
954 B
JavaScript
Raw Normal View History

import DialogModal from 'src/components/dialog_modal/dialog_modal.vue'
2022-02-09 15:50:25 -05:00
2026-06-10 02:12:03 +03:00
import { library } from '@fortawesome/fontawesome-svg-core'
import { faCircleQuestion } from '@fortawesome/free-solid-svg-icons'
library.add(faCircleQuestion)
2022-02-09 15:50:25 -05:00
/**
* This component emits the following events:
* cancelled, emitted when the action should not be performed;
* accepted, emitted when the action should be performed;
*
* The caller should close this dialog after receiving any of the two events.
*/
const ConfirmModal = {
components: {
2026-01-06 16:22:52 +02:00
DialogModal,
2022-02-09 15:50:25 -05:00
},
props: {
title: {
2026-01-06 16:22:52 +02:00
type: String,
2022-02-09 15:50:25 -05:00
},
cancelText: {
2026-01-06 16:22:52 +02:00
type: String,
2022-02-09 15:50:25 -05:00
},
confirmText: {
2026-01-06 16:22:52 +02:00
type: String,
},
2026-05-05 12:10:17 +03:00
confirmDanger: {
type: Boolean,
},
2022-02-09 15:50:25 -05:00
},
2025-02-05 08:37:00 +02:00
emits: ['cancelled', 'accepted'],
2026-01-06 16:22:52 +02:00
computed: {},
2022-02-09 15:50:25 -05:00
methods: {
2026-01-06 16:22:52 +02:00
onCancel() {
2022-02-09 15:50:25 -05:00
this.$emit('cancelled')
},
2026-01-06 16:22:52 +02:00
onAccept() {
2022-02-09 15:50:25 -05:00
this.$emit('accepted')
2026-01-06 16:22:52 +02:00
},
},
2022-02-09 15:50:25 -05:00
}
export default ConfirmModal