[FE] Add spinner to register creation

This commit is contained in:
Araozu 2023-10-02 21:33:29 -05:00
parent 367bf1e62a
commit adee604b6c

View File

@ -6,6 +6,7 @@ import { RegisterBatchCreate } from "../../types/Register";
import { RegistrationPreview } from "."; import { RegistrationPreview } from ".";
import { loadCustomLabels } from "../../utils/allCustomLabels"; import { loadCustomLabels } from "../../utils/allCustomLabels";
import { FileDashedIcon } from "../../icons/FileDashedIcon"; import { FileDashedIcon } from "../../icons/FileDashedIcon";
import { LoadingIcon } from "../../icons/LoadingIcon";
function isoDateToLocalDate(date: string): string { function isoDateToLocalDate(date: string): string {
@ -65,12 +66,23 @@ export function RegisterPreview(props: {selections: Array<RegistrationPreview>,
<button <button
class="bg-c-primary text-c-on-primary px-4 py-2 rounded-full cursor-pointer mt-4 class="bg-c-primary text-c-on-primary px-4 py-2 rounded-full cursor-pointer mt-4
disabled:opacity-50 disabled:cursor-not-allowed" disabled:opacity-50 disabled:cursor-not-allowed relative"
type="button" type="button"
disabled={props.selections.length === 0 || loading()} disabled={props.selections.length === 0 || loading()}
onclick={submit} onclick={submit}
> >
Registrar los {props.selections.length} cursos <span
class="absolute top-1 left-2"
style={{display: loading() ? "inline-block" : "none"}}
>
<LoadingIcon
class="animate-spin"
fill="var(--c-primary-container)"
/>
</span>
<span class="ml-6">
Registrar {props.selections.length} cursos
</span>
</button> </button>
</div> </div>
</FilledCard> </FilledCard>