Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SidebarItem as links in viewer sidebars #503

Merged
merged 1 commit into from
Apr 2, 2024
Merged
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
16 changes: 15 additions & 1 deletion src/lib/components/sidebar/SidebarItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,25 @@
export let disabled = false;
export let small = false;
export let hover = false;
// handling link behavior
export let href: string = undefined;
export let target: string = undefined;
export let rel: string = undefined;
export let download: boolean | string = undefined;
</script>

{#if href}
<a {href} class="container" class:disabled class:small on:click on:keydown>
<a
{href}
{target}
{rel}
{download}
class="container"
class:disabled
class:small
on:click
on:keydown
>
<slot />
</a>
{:else}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
export const meta = {
title: "Components / Sidebar / Item",
component: SidebarItem,
tags: ["autodocs"],
parameters: { layout: "centered" },
};

Expand Down
20 changes: 10 additions & 10 deletions src/routes/documents/[id]-[slug]/sidebar/Actions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
</SignedIn>
</SidebarItem>

<SidebarItem>
<SidebarItem href={revisions}>
<History16 />
<a href={revisions}>Revision History</a>
Revision History
</SidebarItem>

<SidebarItem>
<SidebarItem href={pdf} download>
<Download16 />
<a target="_blank" rel="noopener noreferrer" href={pdf}>Download PDF</a>
Download File
</SidebarItem>
</Flex>

Expand All @@ -61,19 +61,19 @@
Share &hellip;
</SidebarItem>

<SidebarItem>
<SidebarItem href={annotate}>
<Comment16 />
<a href={annotate}>Add a note &hellip;</a>
Add a note &hellip;
</SidebarItem>

<SidebarItem>
<SidebarItem href={redact}>
<EyeClosed16 />
<a href={redact}>Redact &hellip;</a>
Redact &hellip;
</SidebarItem>

<SidebarItem>
<SidebarItem href={modify}>
<Apps16 />
<a href={modify}>Modify Pages &hellip;</a>
Modify Pages &hellip;
</SidebarItem>
</Flex>

Expand Down
Loading