Files
fnx_web/svelte/src/filesystem/Breadcrumbs.svelte

80 lines
1.8 KiB
Svelte
Raw Normal View History

<script lang="ts">
import { fs_encode_path } from "lib/FilesystemAPI.svelte";
2026-02-19 18:15:06 +01:00
import { path_link, type FSNavigator } from "./FSNavigator";
import { menu_is_open } from "wrap/MainMenu.svelte";
2026-02-26 14:47:01 +01:00
import FileMenu from "./filemanager/FileMenu.svelte";
import EditWindow from "./edit_window/EditWindow.svelte";
2026-02-26 14:47:01 +01:00
let {
nav,
edit_window = null
}: {
2025-10-13 16:05:50 +02:00
nav: FSNavigator;
2026-02-26 14:47:01 +01:00
edit_window?: EditWindow;
2025-10-13 16:05:50 +02:00
} = $props();
2026-02-26 14:47:01 +01:00
let file_menu: FileMenu = $state()
</script>
2026-02-19 18:15:06 +01:00
<div class="breadcrumbs" class:menu_closed={!$menu_is_open}>
{#each $nav.path as node, i (node.path)}
2026-02-26 14:47:01 +01:00
<a
href={"/d"+fs_encode_path(node.path)}
class="breadcrumb button flat"
use:path_link={{nav: nav, node: node}}
oncontextmenu={e => file_menu.open(node, e.target, e)}
>
2024-05-17 16:32:53 +02:00
{#if node.abuse_type !== undefined}
<i class="icon small">block</i>
{:else if node.is_shared()}
<i class="icon small">share</i>
{/if}
<div class="node_name" class:base={$nav.base_index === i}>
{node.name}
</div>
</a>
2025-10-09 15:48:23 +02:00
{#if $nav.base_index !== i}
<i class="icon">chevron_right</i>
{/if}
{/each}
</div>
2026-02-26 14:47:01 +01:00
<FileMenu bind:this={file_menu} nav={nav} edit_window={edit_window} />
<style>
.breadcrumbs {
2025-10-09 15:48:23 +02:00
flex: 0 0 auto;
display: flex;
align-items: center;
2025-10-09 15:48:23 +02:00
justify-content: left;
flex-wrap: wrap;
flex-direction: row;
2023-11-16 12:17:36 +01:00
overflow: hidden;
2025-10-09 15:48:23 +02:00
background: var(--shaded_background);
backdrop-filter: blur(4px);
border-bottom: 1px solid var(--separator);
}
.breadcrumb {
min-width: 1em;
text-align: center;
word-break: break-all;
2024-02-28 15:50:57 +01:00
display: inline-flex;
flex-direction: row;
2025-10-09 15:48:23 +02:00
background-color: unset;
box-shadow: none;
}
.node_name {
max-width: 20vw;
2024-04-10 18:35:51 +02:00
overflow-x: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
2024-02-28 15:50:57 +01:00
.base {
2023-11-16 12:17:36 +01:00
/* The base name uses all available space */
max-width: unset;
}
2026-02-19 18:15:06 +01:00
.menu_closed {
padding-left: 2em;
}
</style>