-
Notifications
You must be signed in to change notification settings - Fork 103
/
ProfileActionButton.svelte
81 lines (76 loc) · 2.64 KB
/
ProfileActionButton.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<script lang="ts">
import { Icon as IconEnum } from '@lib/auxiliary/icon'
import { FontWeight, Icon, Text, TextType } from '@ui'
export let primaryText: string = ''
export let secondaryText: string = ''
export let icon: IconEnum = undefined
export let iconColor: string = 'blue-500'
export let disabled: boolean = false
export let classes: string = ''
export let color: string = 'transparent'
export let onClick: () => unknown
const secondaryIcon = IconEnum.ChevronRight
const secondaryIconColor = 'gray-500'
</script>
<button
type="button"
{disabled}
class="w-full rounded-xl p-4 cursor-pointer text-left border border-solid border-{color === 'transparent'
? 'gray-200'
: color} dark:border-{color === 'transparent' ? 'gray-600' : color} bg-{color} bg-opacity-30 {classes}"
on:click|stopPropagation={onClick}
>
<div class="grid grid-cols-12 gap-4">
{#if icon}
<div class="col-span-1 h-full flex justify-center items-center justify-items-center">
<Icon height={24} width={24} {icon} classes="text-{iconColor}" />
</div>
{/if}
<div
class="
h-full flex items-center
{icon ? 'col-start-2' : 'col-start-1'}
{!disabled ? 'col-end-12' : 'col-end-13'}
"
>
<span class="flex flex-col justify-center space-y-0.5">
<Text
type={TextType.p}
color="gray-800"
darkColor="white"
fontSize="14"
fontWeight={FontWeight.semibold}
lineHeight="5"
>
{primaryText}
</Text>
{#if secondaryText}
<Text
type={TextType.p}
color="gray-600"
darkColor="gray-400"
fontSize="12"
fontWeight={FontWeight.normal}
lineHeight="3.5"
>
{secondaryText}
</Text>
{/if}
</span>
</div>
<div class="col-span-1 col-end-13 h-full flex justify-center items-center justify-items-center">
<Icon icon={secondaryIcon} classes="text-{secondaryIconColor}" />
</div>
</div>
</button>
<style type="text/scss">
button {
&:disabled {
@apply pointer-events-none;
@apply opacity-50;
:global(svg) {
@apply text-gray-500;
}
}
}
</style>