Added song loading state

This commit is contained in:
lucast committed 2026-10-05 03:46:47 +02:00
1 parent 869ca7d728
commit e908ae27ad
3 files changed
+51 -23

No files matched your search

+21 -1
View File
@@ -47,6 +47,8 @@ interface ModalFormProps<T> {
fields: Field<T>[]
title?: string
onSave: (value: any) => Promise<boolean>
loading?: boolean
loadingText?: string
}
const props = defineProps<ModalFormProps<any>>()
@@ -150,7 +152,10 @@ watch(
/>
</template>
<Button type="submit" full center-text>Save</Button>
<Button type="submit" full center-text :disabled="props.loading">
<span v-if="props.loading" class="spinner" aria-hidden="true" />
{{ props.loading ? props.loadingText || "Saving…" : "Save" }}
</Button>
</form>
</Modal>
</template>
@@ -169,4 +174,19 @@ watch(
flex-direction: column;
gap: 0.8rem;
}
.spinner {
width: 1rem;
height: 1rem;
border: 2px solid currentColor;
border-right-color: transparent;
border-radius: 50%;
animation: spin 0.7s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
</style>