Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Apr 12, 2024
2 parents 6c90648 + 13928e7 commit 5bc1b8c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
16 changes: 11 additions & 5 deletions src/lib/components/sidebar/SidebarItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
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;
Expand Down Expand Up @@ -41,9 +42,9 @@
border-radius: 0.25rem;
border: none;
color: inherit;
fill: inherit;
background: transparent;
color: var(--color, inherit);
fill: var(--fill, inherit);
background: var(--background, transparent);
font-family: var(--font-sans, "Source Sans Pro");
font-size: var(--font-m, 1rem);
Expand All @@ -59,7 +60,9 @@
.container.hover:hover,
.container.hover:focus {
cursor: pointer;
background: var(--gray-2, #d8dee2);
background: var(--hover-background, var(--gray-2, #d8dee2));
color: var(--hover-color, var(--color, inherit));
fill: var(--hover-fill, var(--fill, inherit));
}
@media (hover: none) {
a.container:hover,
Expand All @@ -76,8 +79,11 @@
background: transparent;
}
/* Active */
.container.active {
background-color: var(--blue-2, #b5ceed);
background: var(--active-background, var(--blue-2, #b5ceed));
color: var(--active-color, var(--color, inherit));
fill: var(--active-fill, var(--fill, inherit));
}
/* Small */
Expand Down
20 changes: 19 additions & 1 deletion src/lib/components/sidebar/stories/SidebarItem.stories.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script context="module" lang="ts">
import { Story } from "@storybook/addon-svelte-csf";
import { action } from "@storybook/addon-actions";
import { Comment16, Home16, Link16, Paintbrush16 } from "svelte-octicons";
import SidebarItem from "../SidebarItem.svelte";
import { Comment16, Home16 } from "svelte-octicons";
import Flex from "../../common/Flex.svelte";
export const meta = {
title: "Components / Sidebar / Item",
Expand Down Expand Up @@ -43,6 +44,23 @@
</SidebarItem>
</Story>

<Story name="Active">
<Flex>
<SidebarItem active>Static</SidebarItem>
<SidebarItem active href="#">
<Link16 /> Link
</SidebarItem>
<SidebarItem
active
--active-background="var(--orange-light)"
--active-color="var(--orange-dark)"
--active-fill="var(--orange)"
>
<Paintbrush16 /> Custom Active Colors
</SidebarItem>
</Flex>
</Story>

<Story name="Small">
<SidebarItem small>
<Comment16 /> Add a note…
Expand Down

0 comments on commit 5bc1b8c

Please sign in to comment.