2024-08-22 11:38:19 -04:00
|
|
|
<script lang="ts">
|
|
|
|
|
import Tree from '$lib/components/shared-components/tree/tree.svelte';
|
2024-08-29 12:14:03 -04:00
|
|
|
import { normalizeTreePath, type RecursiveObject } from '$lib/utils/tree-utils';
|
2024-08-22 11:38:19 -04:00
|
|
|
|
2024-11-14 08:43:25 -06:00
|
|
|
interface Props {
|
|
|
|
|
items: RecursiveObject;
|
|
|
|
|
parent?: string;
|
|
|
|
|
active?: string;
|
|
|
|
|
icons: { default: string; active: string };
|
|
|
|
|
getLink: (path: string) => string;
|
|
|
|
|
getColor?: (path: string) => string | undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let { items, parent = '', active = '', icons, getLink, getColor = () => undefined }: Props = $props();
|
2024-08-22 11:38:19 -04:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<ul class="list-none ml-2">
|
2024-08-29 12:14:03 -04:00
|
|
|
{#each Object.entries(items) as [path, tree]}
|
|
|
|
|
{@const value = normalizeTreePath(`${parent}/${path}`)}
|
|
|
|
|
{@const key = value + getColor(value)}
|
|
|
|
|
{#key key}
|
|
|
|
|
<li>
|
|
|
|
|
<Tree {parent} value={path} {tree} {icons} {active} {getLink} {getColor} />
|
|
|
|
|
</li>
|
|
|
|
|
{/key}
|
2024-08-22 11:38:19 -04:00
|
|
|
{/each}
|
|
|
|
|
</ul>
|