2023-05-17 15:34:56 +02:00
|
|
|
<script>
|
2023-05-30 16:59:11 +02:00
|
|
|
import { fs_encode_path } from "./FilesystemUtil";
|
|
|
|
|
2023-05-17 15:34:56 +02:00
|
|
|
export let state = {}
|
2023-05-17 22:46:27 +02:00
|
|
|
export let fs_navigator
|
2023-05-17 15:34:56 +02:00
|
|
|
</script>
|
|
|
|
|
2023-11-15 15:50:54 +01:00
|
|
|
<div class="breadcrumbs">
|
|
|
|
{#each state.path as node, i (node.path)}
|
|
|
|
{@const shared = node.id !== undefined && node.id !== "me"}
|
|
|
|
<a
|
|
|
|
href={"/d"+fs_encode_path(node.path)}
|
|
|
|
class="breadcrumb button"
|
|
|
|
class:button_highlight={state.base_index === i}
|
|
|
|
on:click|preventDefault={() => {fs_navigator.navigate(node.path, true)}}
|
|
|
|
>
|
|
|
|
{#if shared}
|
|
|
|
<i class="icon small">share</i>
|
|
|
|
{/if}
|
|
|
|
<div class="node_name" class:nopad={shared} class:base={state.base_index === i}>
|
|
|
|
{node.name}
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
{/each}
|
|
|
|
</div>
|
2023-05-17 15:34:56 +02:00
|
|
|
|
|
|
|
<style>
|
2023-11-15 15:50:54 +01:00
|
|
|
.breadcrumbs {
|
|
|
|
flex-grow: 1;
|
|
|
|
flex-shrink: 1;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
flex-direction: row;
|
2023-11-16 12:17:36 +01:00
|
|
|
overflow: hidden;
|
2023-11-15 15:50:54 +01:00
|
|
|
}
|
2023-05-17 15:34:56 +02:00
|
|
|
.breadcrumb {
|
|
|
|
min-width: 1em;
|
|
|
|
text-align: center;
|
|
|
|
margin: 4px;
|
|
|
|
word-break: break-all;
|
2023-05-17 19:27:46 +02:00
|
|
|
padding: 0;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
}
|
|
|
|
.node_name {
|
2023-11-16 12:17:36 +01:00
|
|
|
margin: 2px 8px;
|
2023-11-15 15:50:54 +01:00
|
|
|
max-width: 20vw;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
|
|
|
.node_name.base {
|
2023-11-16 12:17:36 +01:00
|
|
|
/* The base name uses all available space */
|
|
|
|
max-width: unset;
|
2023-05-17 19:27:46 +02:00
|
|
|
}
|
|
|
|
.nopad {
|
|
|
|
margin-left: 0;
|
|
|
|
}
|
|
|
|
.icon {
|
|
|
|
margin: 2px 4px;
|
2023-05-17 15:34:56 +02:00
|
|
|
}
|
|
|
|
</style>
|