2021-05-07 03:43:37 +03:00
|
|
|
<script>
|
2022-01-03 20:28:35 +02:00
|
|
|
import { stores } from '@sapper/app';
|
|
|
|
|
import ChevronDown24 from 'carbon-icons-svelte/lib/ChevronDown24';
|
|
|
|
|
import ChevronUp24 from 'carbon-icons-svelte/lib/ChevronUp24';
|
|
|
|
|
import Link24 from 'carbon-icons-svelte/lib/Link24';
|
2021-05-07 03:43:37 +03:00
|
|
|
|
2022-01-03 20:28:35 +02:00
|
|
|
export let id = '';
|
|
|
|
|
export let title = '';
|
|
|
|
|
export let titleClass = '';
|
|
|
|
|
export let disableContainerPadding = false;
|
|
|
|
|
export let rootClass = '';
|
|
|
|
|
export let supportsLink = false;
|
2021-05-07 03:43:37 +03:00
|
|
|
|
2022-01-03 20:28:35 +02:00
|
|
|
export let isExpanded = true;
|
|
|
|
|
|
|
|
|
|
const { page } = stores();
|
|
|
|
|
|
|
|
|
|
function handleClick(e) {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
|
|
isExpanded = !isExpanded;
|
2021-05-07 03:43:37 +03:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
2023-05-05 20:19:45 +00:00
|
|
|
<div {id} class="w-full bg-white dark:bg-gray-800 {rootClass}">
|
2021-07-01 09:31:26 +03:00
|
|
|
<div
|
2022-01-03 20:28:35 +02:00
|
|
|
class="w-full relative flex items-center justify-between {!disableContainerPadding &&
|
|
|
|
|
'p-5'}"
|
2021-07-01 09:31:26 +03:00
|
|
|
role="button"
|
|
|
|
|
tabindex="0"
|
2022-01-03 20:28:35 +02:00
|
|
|
on:click={handleClick}
|
2021-07-01 09:31:26 +03:00
|
|
|
>
|
2023-05-05 20:19:45 +00:00
|
|
|
<p class="dark:text-white font-bold flex items-center {titleClass}">
|
2022-01-03 20:28:35 +02:00
|
|
|
{title}
|
|
|
|
|
{#if supportsLink}
|
|
|
|
|
<a
|
|
|
|
|
class="ml-2"
|
|
|
|
|
href="{$page.path}#{id}"
|
|
|
|
|
on:click={(e) => e.stopPropagation()}
|
|
|
|
|
>
|
|
|
|
|
<Link24 class="carbon-icon" />
|
|
|
|
|
</a>
|
|
|
|
|
{/if}
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
{#if isExpanded}
|
|
|
|
|
<ChevronUp24 class="carbon-icon" />
|
|
|
|
|
{:else}
|
|
|
|
|
<ChevronDown24 class="carbon-icon" />
|
2021-07-01 09:31:26 +03:00
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
{#if isExpanded}
|
2022-01-03 20:28:35 +02:00
|
|
|
<div class="flex flex-col p-5">
|
2021-07-01 09:31:26 +03:00
|
|
|
<slot />
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|