Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 77 additions & 35 deletions src/lib/components/bottom-nav.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,30 @@
},
]
>;
centerButton?: Snippet<
[
{
open: boolean;
onClick: () => void;
},
]
>;
menuButton?: Snippet<
[
{
open: boolean;
onClick: () => void;
},
]
>;
linksContent?: Snippet<
[
{
open: boolean;
closeMenu: () => void;
},
]
>;
profilePicture?: Snippet;
class?: ClassNameValue;
}
Expand All @@ -44,6 +68,9 @@
showNamespacePicker = true,
children,
nsPicker,
centerButton,
menuButton,
linksContent,
profilePicture,
class: className = '',
}: Props = $props();
Expand Down Expand Up @@ -122,11 +149,15 @@
out:slide={{ duration: 200, delay: 0 }}
>
{#if viewLinks}
<div
class="flex h-full flex-col-reverse justify-start gap-6 overflow-auto px-4 py-8"
>
{@render linksSnippet?.()}
</div>
{#if linksContent}
{@render linksContent({ open: viewLinks, closeMenu })}
{:else}
<div
class="flex h-full flex-col-reverse justify-start gap-6 overflow-auto px-4 py-8"
>
{@render linksSnippet?.()}
</div>
{/if}
{/if}
{#if nsPicker}
{@render nsPicker({ open: viewNamespaces, closeMenu })}
Expand All @@ -150,38 +181,49 @@
data-testid="top-nav"
aria-label={translate('common.main')}
>
<button
class="nav-button relative"
data-testid="nav-menu-button"
class:active-shadow={viewLinks}
type="button"
onclick={onLinksClick}
>
{#if viewLinks}
<Icon name="close" height={32} width={32} />
{#if menuButton}
{@render menuButton({ open: viewLinks, onClick: onLinksClick })}
{:else}
<button
class="nav-button relative"
data-testid="nav-menu-button"
class:active-shadow={viewLinks}
type="button"
onclick={onLinksClick}
>
{#if viewLinks}
<Icon name="close" height={32} width={32} />
{:else}
<Logo height={32} width={32} />
{/if}
</button>
{/if}
{#if showNamespacePicker}
{#if centerButton}
{@render centerButton({
open: viewNamespaces,
onClick: onNamespaceClick,
})}
{:else}
<Logo height={32} width={32} />
<div class="namespace-wrapper">
<Button
variant="ghost"
data-testid="namespace-switcher"
leadingIcon="namespace-switcher"
size="xs"
class="grow text-white"
on:click={onNamespaceClick}>{truncateNamespace(namespace)}</Button
>
<div class="ml-1 h-full w-1 border-l border-subtle"></div>
<Button
variant="ghost"
size="xs"
href={routeForNamespace({ namespace })}
disabled={!namespaceExists}
><Icon class="text-white" name="external-link" /></Button
>
</div>
{/if}
</button>
{#if showNamespacePicker}
<div class="namespace-wrapper">
<Button
variant="ghost"
data-testid="namespace-switcher"
leadingIcon="namespace-switcher"
size="xs"
class="grow text-white"
on:click={onNamespaceClick}>{truncateNamespace(namespace)}</Button
>
<div class="ml-1 h-full w-1 border-l border-subtle"></div>
<Button
variant="ghost"
size="xs"
href={routeForNamespace({ namespace })}
disabled={!namespaceExists}
><Icon class="text-white" name="external-link" /></Button
>
</div>
{/if}
<button
class="nav-button"
Expand Down
2 changes: 2 additions & 0 deletions src/lib/holocene/icon/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import arrowUp from './svg/arrow-up.svelte';
import ascending from './svg/ascending.svelte';
import astronaut from './svg/astronaut.svelte';
import aws from './svg/aws.svelte';
import bars from './svg/bars.svelte';
import batchOperation from './svg/batch-operation.svelte';
import book from './svg/book-sparkles.svelte';
import bookmark from './svg/bookmark.svelte';
Expand Down Expand Up @@ -168,6 +169,7 @@ export const icons = {
ascending,
astronaut,
aws,
bars,
'batch-operation': batchOperation,
book,
bookmark,
Expand Down
34 changes: 34 additions & 0 deletions src/lib/holocene/icon/svg/bars.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<script lang="ts">
import Svg from '../svg.svelte';
let props = $props();
</script>

<Svg {...props}>
<line
x1="3"
y1="6"
x2="21"
y2="6"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
/>
<line
x1="3"
y1="12"
x2="21"
y2="12"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
/>
<line
x1="3"
y1="18"
x2="21"
y2="18"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
/>
</Svg>