"examples/community/pipeline_demofusion_sdxl.py" did not exist on "20f0cbc88ff6bda5cf0cf6dba2ccf7faa3275d9f"
Collapsible.svelte 1.06 KB
Newer Older
1
<script lang="ts">
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
2
3
	import { slide } from 'svelte/transition';
	import { quintOut } from 'svelte/easing';
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
4
5
6
7

	import ChevronUp from '../icons/ChevronUp.svelte';
	import ChevronDown from '../icons/ChevronDown.svelte';

8
	export let open = false;
9
	export let className = '';
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
10
	export let title = null;
11
12
</script>

13
<div class={className}>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
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
	{#if title !== null}
		<button class="w-full" on:click={() => (open = !open)}>
			<div class=" w-full font-medium transition flex items-center justify-between gap-2">
				<div>
					{title}
				</div>

				<div>
					{#if open}
						<ChevronUp strokeWidth="3.5" className="size-3.5 " />
					{:else}
						<ChevronDown strokeWidth="3.5" className="size-3.5 " />
					{/if}
				</div>
			</div>
		</button>
	{:else}
		<button on:click={() => (open = !open)}>
			<div
				class="flex items-center gap-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition"
			>
				<slot />
			</div>
		</button>
	{/if}
39

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
40
41
42
43
44
45
	{#if open}
		<div transition:slide={{ duration: 300, easing: quintOut, axis: 'y' }}>
			<slot name="content" />
		</div>
	{/if}
</div>