Skip to content

Commit

Permalink
Merge pull request #503 from MuckRock/488-sidebaritem-should-handle-l…
Browse files Browse the repository at this point in the history
…inks

Use SidebarItem as links in viewer sidebars
  • Loading branch information
allanlasser authored Apr 2, 2024
2 parents d6ece9d + e416fe0 commit 8421ee3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
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

0 comments on commit 8421ee3

Please sign in to comment.