<script>
	export let dir;
	export let open = true;

	function get_items() {
		return dir === 'a'
			? [
				{
					filename: 'a/b',
					isDir: true
				}
			]
			: [
				{
					filename: 'a/b/c',
					isDir: false
				}
			];
	}
</script>

<li>
	<span>{dir}</span>

	{#if open}
		<ul>
			{#each get_items() as item (item.filename)}
				{#if item.isDir}
					<svelte:self dir={item.filename}/>
				{:else}
					<li>{item.filename}</li>
				{/if}
			{/each}
		</ul>
	{/if}
</li>