103 lines
2.0 KiB
Svelte
103 lines
2.0 KiB
Svelte
<script>
|
|
import { createEventDispatcher } from 'svelte'
|
|
import { t } from './i18n'
|
|
|
|
export let title = t('common.confirm')
|
|
export let message = ''
|
|
export let confirmText = t('common.delete')
|
|
export let cancelText = t('common.cancel')
|
|
export let danger = false
|
|
const dispatch = createEventDispatcher()
|
|
</script>
|
|
|
|
<div class="overlay" on:click|self={() => dispatch('cancel')} on:keydown={(e) => { if (e.key === 'Escape') { e.preventDefault(); dispatch('cancel') } }} role="presentation">
|
|
<div class="modal">
|
|
<h3>{title}</h3>
|
|
<p class="message">{message}</p>
|
|
<div class="actions">
|
|
<button class="btn {danger ? 'btn-danger' : 'btn-primary'}" on:click={() => dispatch('confirm')}>{confirmText}</button>
|
|
<button class="btn" on:click={() => dispatch('cancel')}>{cancelText}</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<style>
|
|
.overlay {
|
|
position: fixed;
|
|
inset: 0;
|
|
background: rgba(0, 0, 0, 0.6);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 200;
|
|
}
|
|
|
|
.modal {
|
|
background: #1a1a28;
|
|
border: 1px solid #2a2a3c;
|
|
border-radius: 12px;
|
|
padding: 24px;
|
|
width: 360px;
|
|
max-width: 90vw;
|
|
}
|
|
|
|
h3 {
|
|
font-size: 18px;
|
|
margin-bottom: 12px;
|
|
color: #e4e4ef;
|
|
}
|
|
|
|
.message {
|
|
font-size: 14px;
|
|
color: #aaa;
|
|
margin-bottom: 20px;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.actions {
|
|
display: flex;
|
|
gap: 8px;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
.btn {
|
|
padding: 8px 16px;
|
|
border: 1px solid #2a2a3c;
|
|
background: #1a1a28;
|
|
color: #ccc;
|
|
border-radius: 6px;
|
|
cursor: pointer;
|
|
font-size: 13px;
|
|
font-family: inherit;
|
|
}
|
|
|
|
.btn:hover {
|
|
background: #222233;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: #6366f1;
|
|
border-color: #6366f1;
|
|
color: #fff;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background: #4f46e5;
|
|
}
|
|
|
|
.btn-danger {
|
|
background: #dc2626;
|
|
border-color: #dc2626;
|
|
color: #fff;
|
|
}
|
|
|
|
.btn-danger:hover {
|
|
background: #b91c1c;
|
|
}
|
|
|
|
.btn:focus-visible {
|
|
outline: 2px solid #5588ff;
|
|
outline-offset: 1px;
|
|
}
|
|
</style>
|