-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from labcodes/migrate-narrow-sidebar
Migrate narrow sidebar
- Loading branch information
Showing
12 changed files
with
258 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from "react"; | ||
|
||
import { NarrowSidebar as Component } from "../../confetti-ds/src"; | ||
|
||
import { CollapseButton as CollapseButtonStory } from "./subcomponents/CollapseButton.stories"; | ||
import { FooterButton as FooterButtonStory } from "./subcomponents/FooterButton.stories"; | ||
import { Header as HeaderStory } from "./subcomponents/Header.stories"; | ||
import { Item as ItemStory } from "./subcomponents/Item.stories"; | ||
import { UserAvatar as UserAvatarStory } from "./subcomponents/UserAvatar.stories"; | ||
|
||
export default { | ||
title: "Sidebar/Narrow Sidebar", | ||
component: Component, | ||
parameters: { | ||
backgrounds: { default: "dark" }, | ||
}, | ||
argTypes: { | ||
children: { | ||
control: false, | ||
}, | ||
}, | ||
subcomponents: { | ||
Body: Component.Body, | ||
CollapseButton: Component.CollapseButton, | ||
Footer: Component.Footer, | ||
FooterButton: Component.FooterButton, | ||
Header: Component.Header, | ||
Item: Component.Item, | ||
UserAvatar: Component.UserAvatar, | ||
}, | ||
}; | ||
|
||
export const NarrowSidebar = (args) => ( | ||
<Component {...args} isOpenOnMobile> | ||
<Component.Header {...HeaderStory.args}> | ||
<Component.UserAvatar {...UserAvatarStory.args} /> | ||
<Component.CollapseButton {...CollapseButtonStory.args} /> | ||
</Component.Header> | ||
|
||
<Component.Body> | ||
<Component.Item {...ItemStory.args} isActive /> | ||
<Component.Item {...ItemStory.args} label="With Long Ellipsed Label" /> | ||
<Component.Item {...ItemStory.args} label="With Icon" icon="star" /> | ||
</Component.Body> | ||
|
||
<Component.Footer> | ||
<Component.FooterButton {...FooterButtonStory.args} label="Password" icon="key" /> | ||
</Component.Footer> | ||
</Component> | ||
); |
56 changes: 56 additions & 0 deletions
56
apps/docs/stories/Sidebar/NarrowSidebarWithFooterAvatar.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from "react"; | ||
|
||
import { NarrowSidebar as Component } from "../../confetti-ds/src"; | ||
|
||
import { CollapseButton as CollapseButtonStory } from "./subcomponents/CollapseButton.stories"; | ||
import { FooterButton as FooterButtonStory } from "./subcomponents/FooterButton.stories"; | ||
import { Header as HeaderStory } from "./subcomponents/Header.stories"; | ||
import { Item as ItemStory } from "./subcomponents/Item.stories"; | ||
import { Logotype as LogotypeStory } from "./subcomponents/Logotype.stories"; | ||
import { UserAvatar as UserAvatarStory } from "./subcomponents/UserAvatar.stories"; | ||
|
||
export default { | ||
title: "Sidebar/Narrow Sidebar With Footer Avatar", | ||
component: Component, | ||
parameters: { | ||
backgrounds: { default: "dark" }, | ||
}, | ||
argTypes: { | ||
children: { | ||
control: false, | ||
}, | ||
}, | ||
subcomponents: { | ||
Body: Component.Body, | ||
CollapseButton: Component.CollapseButton, | ||
Footer: Component.Footer, | ||
FooterButton: Component.FooterButton, | ||
Header: Component.Header, | ||
Item: Component.Item, | ||
Logotype: Component.Logotype, | ||
UserAvatar: Component.UserAvatar, | ||
}, | ||
}; | ||
|
||
export const NarrowSidebarWithFooterAvatar = (args) => ( | ||
<Component {...args} isOpenOnMobile> | ||
<Component.Header {...HeaderStory.args}> | ||
<Component.Logotype {...LogotypeStory.args} /> | ||
<Component.CollapseButton {...CollapseButtonStory.args} /> | ||
</Component.Header> | ||
|
||
<Component.Body> | ||
<Component.Item {...ItemStory.args} isActive /> | ||
<Component.Item {...ItemStory.args} label="With Long Ellipsed Label" /> | ||
<Component.Item {...ItemStory.args} label="With Icon" icon="star" /> | ||
</Component.Body> | ||
|
||
<Component.Footer> | ||
<Component.UserAvatar {...UserAvatarStory.args} /> | ||
<Component.FooterButton {...FooterButtonStory.args} label="Password" icon="key" /> | ||
</Component.Footer> | ||
</Component> | ||
); | ||
|
||
NarrowSidebarWithFooterAvatar.args = { | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from "react"; | ||
|
||
import { NarrowSidebar } from "../../../confetti-ds/src"; | ||
const { Body: Component } = NarrowSidebar; | ||
|
||
export default { | ||
title: "Sidebar/Subcomponents/Body", | ||
component: Component, | ||
argTypes: { | ||
children: { | ||
control: false, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Body = (args) => <Component {...args} />; |
19 changes: 19 additions & 0 deletions
19
apps/docs/stories/Sidebar/subcomponents/CollapseButton.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from "react"; | ||
|
||
import { NarrowSidebar } from "../../../confetti-ds/src"; | ||
const { CollapseButton: Component } = NarrowSidebar; | ||
|
||
export default { | ||
title: "Sidebar/Subcomponents/Collapse Button", | ||
component: Component, | ||
parameters: { | ||
viewport: { | ||
defaultViewport: "mobile1", | ||
}, | ||
}, | ||
}; | ||
|
||
export const CollapseButton = (args) => <Component {...args} />; | ||
CollapseButton.args = { | ||
onClick: () => {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from "react"; | ||
|
||
import { NarrowSidebar } from "../../../confetti-ds/src"; | ||
const { Footer: Component } = NarrowSidebar; | ||
|
||
export default { | ||
title: "Sidebar/Subcomponents/Footer", | ||
component: Component, | ||
argTypes: { | ||
children: { | ||
control: false, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Footer = (args) => <Component {...args} />; |
21 changes: 21 additions & 0 deletions
21
apps/docs/stories/Sidebar/subcomponents/FooterButton.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from "react"; | ||
|
||
import { NarrowSidebar } from "../../../confetti-ds/src"; | ||
import { ICON_TYPES } from "../../../confetti-ds/src/constants"; | ||
const { FooterButton: Component } = NarrowSidebar; | ||
|
||
export default { | ||
title: "Sidebar/Subcomponents/Footer Button", | ||
component: Component, | ||
argTypes: { | ||
icon: { | ||
control: { type: "select", options: ICON_TYPES }, | ||
}, | ||
}, | ||
}; | ||
|
||
export const FooterButton = (args) => <Component {...args} />; | ||
FooterButton.args = { | ||
onClick: () => alert("Footer Button clicked"), | ||
label: "Footer Button", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from "react"; | ||
|
||
import { NarrowSidebar } from "../../../confetti-ds/src"; | ||
const { Header: Component } = NarrowSidebar; | ||
|
||
export default { | ||
title: "Sidebar/Subcomponents/Header", | ||
component: Component, | ||
argTypes: { | ||
children: { | ||
control: false, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Header = (args) => <Component {...args} />; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from "react"; | ||
|
||
import { NarrowSidebar } from "../../../confetti-ds/src"; | ||
import { ICON_TYPES } from "../../../confetti-ds/src/constants"; | ||
const { Item: Component } = NarrowSidebar; | ||
|
||
export default { | ||
title: "Sidebar/Subcomponents/Item", | ||
component: Component, | ||
argTypes: { | ||
icon: { | ||
control: { type: "select", options: ICON_TYPES }, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Item = (args) => <Component {...args} />; | ||
Item.args = { | ||
onClick: () => alert("Item clicked"), | ||
label: "Sidebar Item", | ||
} |
21 changes: 21 additions & 0 deletions
21
apps/docs/stories/Sidebar/subcomponents/Logotype.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from "react"; | ||
|
||
import { NarrowSidebar } from "../../../confetti-ds/src"; | ||
import logo from "./logo.png"; | ||
const { Logotype: Component } = NarrowSidebar; | ||
|
||
export default { | ||
title: "Sidebar/Subcomponents/Logotype", | ||
component: Component, | ||
parameters: { | ||
viewport: { | ||
defaultViewport: "mobile1", | ||
}, | ||
}, | ||
}; | ||
|
||
export const Logotype = (args) => <Component {...args} />; | ||
Logotype.args = { | ||
logoSrc: logo, | ||
altText: "Labcodes' logo" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions
22
apps/docs/stories/Sidebar/subcomponents/UserAvatar.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from "react"; | ||
|
||
import { NarrowSidebar } from "../../../confetti-ds/src"; | ||
import mrgeraldo from "./MrGeraldo.png"; | ||
const { UserAvatar: Component } = NarrowSidebar; | ||
|
||
export default { | ||
title: "Sidebar/Subcomponents/User Avatar", | ||
component: Component, | ||
parameters: { | ||
viewport: { | ||
defaultViewport: "mobile1", | ||
}, | ||
}, | ||
}; | ||
|
||
export const UserAvatar = (args) => <Component {...args} />; | ||
UserAvatar.args = { | ||
avatarSrc: mrgeraldo, | ||
altText: "Mr. Geraldo", | ||
caption: "Bot and Administrator" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.