Skip to content

Commit

Permalink
Merge pull request #15 from labcodes/migrate-narrow-sidebar
Browse files Browse the repository at this point in the history
Migrate narrow sidebar
  • Loading branch information
lucianoratamero authored Feb 19, 2021
2 parents c691146 + 05a9297 commit f6103e9
Show file tree
Hide file tree
Showing 12 changed files with 258 additions and 0 deletions.
50 changes: 50 additions & 0 deletions apps/docs/stories/Sidebar/NarrowSidebar.stories.js
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 apps/docs/stories/Sidebar/NarrowSidebarWithFooterAvatar.stories.js
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 = {
};
16 changes: 16 additions & 0 deletions apps/docs/stories/Sidebar/subcomponents/Body.stories.js
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 apps/docs/stories/Sidebar/subcomponents/CollapseButton.stories.js
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: () => {}
}
16 changes: 16 additions & 0 deletions apps/docs/stories/Sidebar/subcomponents/Footer.stories.js
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 apps/docs/stories/Sidebar/subcomponents/FooterButton.stories.js
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",
}
16 changes: 16 additions & 0 deletions apps/docs/stories/Sidebar/subcomponents/Header.stories.js
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} />;
21 changes: 21 additions & 0 deletions apps/docs/stories/Sidebar/subcomponents/Item.stories.js
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 apps/docs/stories/Sidebar/subcomponents/Logotype.stories.js
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 apps/docs/stories/Sidebar/subcomponents/UserAvatar.stories.js
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"
}
Binary file added apps/docs/stories/Sidebar/subcomponents/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f6103e9

Please sign in to comment.