Skip to content

Commit 6bb47e0

Browse files
committed
Add and organize stories
1 parent a5ca439 commit 6bb47e0

File tree

5 files changed

+69
-5
lines changed

5 files changed

+69
-5
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { Story } from "@storybook/react"
2+
import React from "react"
3+
import { BorderedMenu, BorderedMenuProps } from "."
4+
import { BuildingIcon } from "../Icons/BuildingIcon"
5+
import { UsersOutlinedIcon } from "../Icons/UsersOutlinedIcon"
6+
import { BorderedMenuRow } from "./BorderedMenuRow"
7+
8+
export default {
9+
title: "Navbar/BorderedMenu",
10+
component: BorderedMenu,
11+
}
12+
13+
const Template: Story<BorderedMenuProps> = (args: BorderedMenuProps) => (
14+
<BorderedMenu {...args}>
15+
<BorderedMenuRow
16+
title="Item 1"
17+
description="Here's a description"
18+
Icon={BuildingIcon}
19+
/>
20+
<BorderedMenuRow
21+
active
22+
title="Item 2"
23+
description="This BorderedMenuRow is active"
24+
Icon={UsersOutlinedIcon}
25+
/>
26+
</BorderedMenu>
27+
)
28+
29+
export const AdminVariant = Template.bind({})
30+
AdminVariant.args = {
31+
variant: "admin-dropdown",
32+
open: true
33+
}
34+
35+
export const UserVariant = Template.bind({})
36+
UserVariant.args = {
37+
variant: "user-dropdown",
38+
open: true
39+
}

site/src/components/BorderedMenu/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from "react"
44

55
type BorderedMenuVariant = "admin-dropdown" | "user-dropdown"
66

7-
type BorderedMenuProps = Omit<PopoverProps, "variant"> & {
7+
export type BorderedMenuProps = Omit<PopoverProps, "variant"> & {
88
variant?: BorderedMenuVariant
99
}
1010

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Box from "@material-ui/core/Box"
2+
import { Story } from "@storybook/react"
3+
import React from "react"
4+
import { AdminDropdown } from "."
5+
6+
export default {
7+
title: "Navbar/AdminDropdown",
8+
component: AdminDropdown,
9+
}
10+
11+
const Template: Story = () => (
12+
<Box style={{ backgroundColor: "#000", width: 100 }}>
13+
<AdminDropdown />
14+
</Box>
15+
)
16+
17+
export const Example = Template.bind({})

site/src/components/Navbar/NavbarView/NavbarView.stories.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from "react"
33
import { NavbarView, NavbarViewProps } from "."
44

55
export default {
6-
title: "Page/NavbarView",
6+
title: "Navbar/NavbarView",
77
component: NavbarView,
88
argTypes: {
99
onSignOut: { action: "Sign Out" },
@@ -12,8 +12,16 @@ export default {
1212

1313
const Template: Story<NavbarViewProps> = (args: NavbarViewProps) => <NavbarView {...args} />
1414

15-
export const Primary = Template.bind({})
16-
Primary.args = {
15+
export const ForAdmin = Template.bind({})
16+
ForAdmin.args = {
17+
user: { id: "1", username: "Administrator", email: "admin@coder.com", created_at: "dawn" },
18+
onSignOut: () => {
19+
return Promise.resolve()
20+
},
21+
}
22+
23+
export const ForMember = Template.bind({})
24+
ForMember.args = {
1725
user: { id: "1", username: "CathyCoder", email: "cathy@coder.com", created_at: "dawn" },
1826
onSignOut: () => {
1927
return Promise.resolve()

site/src/components/Navbar/UserDropdown/UserDropdown.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from "react"
44
import { UserDropdown, UserDropdownProps } from "."
55

66
export default {
7-
title: "Page/UserDropdown",
7+
title: "Navbar/UserDropdown",
88
component: UserDropdown,
99
argTypes: {
1010
onSignOut: { action: "Sign Out" },

0 commit comments

Comments
 (0)