Add some borders. Fix style override when switching pages

This commit is contained in:
2026-02-12 20:00:43 +01:00
parent ec1c8b0f5b
commit cc417535fa
6 changed files with 54 additions and 58 deletions

View File

@@ -47,13 +47,16 @@ onMount(() => {
return
}
// Custom CSS rules for the whole viewer
document.documentElement.style = css_from_path(nav.path)
// Custom CSS rules for the whole viewer. The MainMenu applies its
// styles to the <html> element. So we apply to the <body> element, our
// styles take precedence since they're lower level, and we can clean it
// up afterwards without overwriting global style
document.body.style = css_from_path(nav.path)
})
return () => {
page_sub()
nav_sub()
document.documentElement.style = ""
document.body.style = ""
}
})

View File

@@ -185,7 +185,7 @@ onMount(() => {
max-width: 100%;
background: var(--body_background);
border-radius: 8px;
padding: 2px;
border: 1px solid var(--separator);
text-align: initial;
}
.card_component {

View File

@@ -135,6 +135,7 @@ these padding divs to move it 25% up */
border-radius: 18px 18px 8px 8px;
overflow: hidden;
text-align: left;
border: 1px solid var(--separator);
}
.header {
flex-grow: 0;

View File

@@ -20,10 +20,10 @@ const toggle_menu = (e: MouseEvent) => {
menu_collapsed = !menu_collapsed
}
onMount(async () => {
onMount(() => {
menu_collapsed = document.documentElement.clientWidth < 1000
await loading_run(async () => {
loading_run(async () => {
const user = await get_user()
if (user.username === undefined || user.username === "") {
return

View File

@@ -15,56 +15,52 @@ onMount(() => {
})
</script>
{#if $global_navigator.path.length > 1}
<MenuEntry id="tree_parents" collapsed={menu_collapsed}>
{#snippet title()}
<div class="title">Parent directories</div>
<button title="Navigate up" onclick={() => global_navigator.navigate_up()}>
<i class="icon">north</i>
</button>
{/snippet}
{#snippet body()}
{#each $global_navigator.path.slice(0, $global_navigator.path.length-1) as node (node.id)}
{#if node.type === "dir"}
<div class="row">
<a class="button" href="/d{fs_encode_path(node.path)}" title="{node.name}">
<img class="thumbnail" src="{fs_node_icon(node, 32, 32)}" alt="{node.name}"/>
<span class:hide={menu_collapsed}>{node.name}</span>
</a>
</div>
{/if}
{/each}
{/snippet}
</MenuEntry>
{/if}
{#if siblings.length !== 0}
<MenuEntry id="tree_siblings" collapsed={menu_collapsed}>
{#snippet title()}
<div class="title">Siblings</div>
<button title="Open previous sibling" onclick={() => global_navigator.open_sibling(-1)}>
<i class="icon">west</i>
<MenuEntry id="tree_parents" collapsed={menu_collapsed}>
{#snippet title()}
<div class="title">Parent directories</div>
<button title="Navigate up" onclick={() => global_navigator.navigate_up()}>
<i class="icon">north</i>
</button>
<button title="Open next sibling" onclick={() => global_navigator.open_sibling(1)}>
<i class="icon">east</i>
</button>
{/snippet}
{/snippet}
{#snippet body()}
{#each siblings as node (node.id)}
{#if !node.is_hidden()}
<div class="row">
<a class="button" href="/d{fs_encode_path(node.path)}" title="{node.name}" use:highlight_current_page>
<img class="thumbnail" src="{fs_node_icon(node, 32, 32)}" alt="{node.name}"/>
<span class:hide={menu_collapsed}>{node.name}</span>
</a>
</div>
{/if}
{/each}
{/snippet}
</MenuEntry>
{/if}
{#snippet body()}
{#each $global_navigator.path.slice(0, $global_navigator.path.length-1) as node (node.id)}
{#if node.type === "dir"}
<div class="row">
<a class="button" href="/d{fs_encode_path(node.path)}" title="{node.name}">
<img class="thumbnail" src="{fs_node_icon(node, 32, 32)}" alt="{node.name}"/>
<span class:hide={menu_collapsed}>{node.name}</span>
</a>
</div>
{/if}
{/each}
{/snippet}
</MenuEntry>
<MenuEntry id="tree_siblings" collapsed={menu_collapsed}>
{#snippet title()}
<div class="title">Siblings</div>
<button title="Open previous sibling" onclick={() => global_navigator.open_sibling(-1)}>
<i class="icon">west</i>
</button>
<button title="Open next sibling" onclick={() => global_navigator.open_sibling(1)}>
<i class="icon">east</i>
</button>
{/snippet}
{#snippet body()}
{#each siblings as node (node.id)}
{#if !node.is_hidden()}
<div class="row">
<a class="button" href="/d{fs_encode_path(node.path)}" title="{node.name}" use:highlight_current_page>
<img class="thumbnail" src="{fs_node_icon(node, 32, 32)}" alt="{node.name}"/>
<span class:hide={menu_collapsed}>{node.name}</span>
</a>
</div>
{/if}
{/each}
{/snippet}
</MenuEntry>
<style>
.title {