Compare commits

...

3 Commits

Author SHA1 Message Date
533eb483ea fix: requiring disabled param 2025-01-28 15:56:20 +11:00
b7127c645d fix: loading button disabled styles 2025-01-28 15:55:11 +11:00
de0d1b4660 feat: ui and functionality changes 2025-01-28 15:18:04 +11:00
3 changed files with 28 additions and 6 deletions

View File

@ -1,7 +1,11 @@
<template> <template>
<button <button
type="submit" type="submit"
class="inline-flex h-9 items-center justify-center rounded-md px-3 py-1.5 text-sm font-semibold leading-6 shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 text-white bg-blue-600 hover:bg-blue-500 disabled:text-zinc-400 disabled:bg-blue-600/10 disabled:hover:bg-blue-600/10" :class="[
styles[style].base,
props.disabled ? styles[style].disabled : styles[style].dft,
]"
:disabled="props.disabled"
> >
<div v-if="props.loading" role="status"> <div v-if="props.loading" role="status">
<svg <svg
@ -22,12 +26,29 @@
</svg> </svg>
<span class="sr-only">Loading...</span> <span class="sr-only">Loading...</span>
</div> </div>
<span v-else> <slot v-else />
<slot />
</span>
</button> </button>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps<{ loading: boolean }>(); type Style = "default" | "none";
const props = defineProps<{
loading: boolean;
style?: Style;
disabled?: boolean;
}>();
const style = props.style ?? "default";
const styles: {
[key in Style]: { base: string; dft: string; disabled: string };
} = {
["default"]: {
base: "inline-flex min-h-9 items-center justify-center rounded-md px-3 py-1.5 text-sm font-semibold leading-6 shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600",
dft: "text-white bg-blue-600 hover:bg-blue-500",
disabled:
"text-zinc-400 bg-blue-600/10 hover:bg-blue-600/10",
},
["none"]: { base: "", dft: "", disabled: "" },
};
</script> </script>

View File

@ -7,6 +7,7 @@
:data="modal.data" :data="modal.data"
@event="(event: string) => handleCallback(modalIdx, event)" @event="(event: string) => handleCallback(modalIdx, event)"
/> />
<div id="modalstack" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">

View File

@ -60,7 +60,7 @@
type="submit" type="submit"
class="w-full sm:w-fit" class="w-full sm:w-fit"
> >
{{ props.data.buttonText ?? "Confirm" }} {{ props.data.buttonText ?? "Close" }}
</LoadingButton> </LoadingButton>
</div> </div>
</div> </div>