Skip to content

Commit

Permalink
Applies SidebarItem href and expands anchor attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Apr 2, 2024
1 parent d6ece9d commit e416fe0
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 e416fe0

Please sign in to comment.