vertical and horizontal file list with same component

This commit is contained in:
vcoppe
2024-05-21 17:47:08 +02:00
parent 44b270e2c2
commit d50fdf20a7
7 changed files with 118 additions and 89 deletions

View File

@@ -6,13 +6,22 @@
import { setContext } from 'svelte';
import { writable } from 'svelte/store';
export let orientation: 'vertical' | 'horizontal';
export let recursive = false;
export let selected = writable(new Set<string>());
setContext('orientation', orientation);
setContext('recursive', recursive);
setContext('selected', selected);
</script>
<ScrollArea class="w-fit p-1 pr-4 border">
<div class="w-60 flex flex-col">
<ScrollArea
class={orientation === 'vertical' ? 'p-1 pr-3 border-l' : 'h-10 px-1'}
{orientation}
scrollbarXClasses={orientation === 'vertical' ? '' : 'mt-1 h-2'}
scrollbarYClasses={orientation === 'vertical' ? '' : ''}
>
<div class="flex {orientation === 'vertical' ? 'flex-col' : 'flex-row'} {$$props.class ?? ''}">
<FileListNode node={$fileObservers} id="root" />
</div>
</ScrollArea>