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

30 lines
720 B
Svelte
Raw Normal View History

2021-05-08 11:47:18 +03:00
<script>
2021-08-18 19:47:02 +03:00
import { VARIANTS, VARIANTS_CLASS } from './constants';
export let label = '';
export let className = '';
2021-05-14 08:04:35 +03:00
export let onClick = () => {};
2021-08-18 19:47:02 +03:00
export let name = '';
export let type = 'text';
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-05-08 11:47:18 +03:00
</script>
<button
2021-07-03 19:29:41 +00:00
class="{isDisabled &&
2021-07-06 08:39:17 +03:00
'bg-opacity-25 hover:bg-opacity-25 cursor-not-allowed'} flex items-center h-auto {VARIANTS_CLASS[
variant
]} {!disablePadding &&
2021-07-03 19:29:41 +00:00
'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-08-18 19:47:02 +03:00
{#if !!label}
2021-07-03 19:29:41 +00:00
{label}
{:else}
<slot />
{/if}
2021-05-08 11:47:18 +03:00
</button>