Code snippet, better UX in questionnaire

This commit is contained in:
Rotimi Best
2021-07-03 19:29:41 +00:00
parent b76d1c9647
commit fbdfd3321b
17 changed files with 348 additions and 92 deletions
+1 -1
View File
@@ -6,5 +6,5 @@ export const VARIANTS = {
export const VARIANTS_CLASS = {
[VARIANTS.CONTAINED]: "bg-blue-700 hover:bg-blue-900 text-white font-bold",
[VARIANTS.OUTLINED]:
"border border-blue-700 hover:border-blue-700 hover:bg-blue-200 text-black",
"border border-gray-700 hover:border-black-300 hover:bg-gray-200 text-black",
};
+11 -2
View File
@@ -6,15 +6,24 @@
export let name = "";
export let type;
export let variant = VARIANTS.CONTAINED;
export let disablePadding = false;
export let isDisabled = false;
const variantClass = VARIANTS_CLASS[variant];
</script>
<button
class="h-auto {variantClass} py-1 px-3 rounded {className} transition delay-150 duration-300 ease-in-out"
class="{isDisabled &&
'bg-opacity-25 hover:bg-opacity-25 cursor-not-allowed'} flex items-center h-auto {variantClass} {!disablePadding &&
'py-1 px-5'} rounded {className} transition delay-150 duration-300 ease-in-out "
on:click={onClick}
{name}
{type}
disabled={isDisabled}
>
{label}
{#if label}
{label}
{:else}
<slot />
{/if}
</button>