Added song loading state
This commit is contained in:
1 parent
869ca7d728
commit
e908ae27ad
3 files changed
+51
-23
No files matched your search
@@ -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>
|
||||
Reference in new issue
Block a user