Files
classroomio/apps/dashboard/src/lib/components/OrgSelector/OrgSelectorItem.svelte
T

60 lines
1.3 KiB
Svelte
Raw Normal View History

<script>
2023-09-11 11:47:30 +01:00
import Avatar from '$lib/components/Avatar/index.svelte';
import TextChip from '../Chip/Text.svelte';
2023-05-02 23:55:26 +00:00
import ComingSoon from '../ComingSoon/index.svelte';
2023-09-11 11:47:30 +01:00
export let size = '';
export let hasDivider = false;
export let active = false;
2023-09-11 11:47:30 +01:00
export let avatar = '';
export let avatarText = '';
export let text = '';
2023-09-11 11:47:30 +01:00
export let onClick = () => {};
2023-04-22 20:00:37 +00:00
export let disabled = false;
</script>
2023-04-22 20:00:37 +00:00
<div class="relative">
<button
2024-04-07 06:08:34 +01:00
class="w-full {disabled &&
'opacity-25'} flex items-center text-start w-[14rem] py-1.5 px-2.5 {hasDivider &&
'border-b border-gray-100 dark:border-neutral-600'} {active &&
'bg-gray-200 dark:bg-neutral-700 dark:text-white'}"
2024-02-04 07:58:51 +01:00
on:click={disabled ? undefined : onClick}
2023-04-22 20:00:37 +00:00
>
2023-09-11 11:47:30 +01:00
{#if avatar}
<Avatar
src={avatar}
name={text}
shape="rounded-md"
2024-04-07 06:08:34 +01:00
width="w-[1.2rem]"
height="h-[1.2rem]"
2023-09-11 11:47:30 +01:00
className="mr-2"
/>
{:else if avatarText}
2023-04-22 20:00:37 +00:00
<TextChip
value={avatarText}
2024-04-07 06:08:34 +01:00
className="mr-2 bg-primary-200 font-medium text-xs dark:text-black"
2023-04-22 20:00:37 +00:00
{size}
/>
{/if}
{text}
</button>
{#if disabled}
<div class="coming-soon">
2023-05-02 23:55:26 +00:00
<ComingSoon />
2023-04-22 20:00:37 +00:00
</div>
{/if}
2023-04-22 20:00:37 +00:00
</div>
<style>
button {
min-height: 56px;
}
2023-04-22 20:00:37 +00:00
.coming-soon {
position: absolute;
top: 5px;
right: 5px;
}
</style>