Files
classroomio/src/components/PrimaryButton/index.svelte
T

30 lines
734 B
Svelte
Raw Normal View History

2021-05-08 11:47:18 +03:00
<script>
2021-06-26 21:32:42 +03:00
import { VARIANTS, VARIANTS_CLASS } from "./constants";
2021-05-08 11:47:18 +03:00
export let label;
export let className = "";
2021-05-14 08:04:35 +03:00
export let onClick = () => {};
export let name = "";
export let type;
2021-06-26 21:32:42 +03:00
export let variant = VARIANTS.CONTAINED;
2021-07-03 19:29:41 +00:00
export let disablePadding = false;
export let isDisabled = false;
2021-06-26 21:32:42 +03:00
const variantClass = VARIANTS_CLASS[variant];
2021-05-08 11:47:18 +03:00
</script>
<button
2021-07-03 19:29:41 +00:00
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 "
2021-05-14 08:04:35 +03:00
on:click={onClick}
{name}
{type}
2021-07-03 19:29:41 +00:00
disabled={isDisabled}
2021-05-08 11:47:18 +03:00
>
2021-07-03 19:29:41 +00:00
{#if label}
{label}
{:else}
<slot />
{/if}
2021-05-08 11:47:18 +03:00
</button>