feature: add docz usage example

This commit is contained in:
George Lima 2018-11-26 23:52:47 -03:00
parent 1a439cc6a5
commit 6b1a1414af
2 changed files with 32 additions and 7 deletions

View File

@ -8,17 +8,26 @@ import { styles } from './styles';
// TODO: Not sure this is the best approach to styling
// in a StyledComponents-powered application
const Wrapper = styled.div`${styles.wrapper}`;
const Wrapper = styled.div`
${styles.wrapper}
`;
export const SidebarComponent = () => (
type MenuItem = { route: string, label: string };
type Props = {
options?: MenuItem[],
};
export const SidebarComponent = ({ options }: Props) => (
<Wrapper>
{MENU_OPTIONS.map(item => (
<Link
key={item.route}
to={item.route}
>
{(options || []).map(item => (
<Link key={item.route} to={item.route}>
{item.label}
</Link>
))}
</Wrapper>
);
SidebarComponent.defaultProps = {
options: MENU_OPTIONS,
};

View File

@ -0,0 +1,16 @@
---
name: Sidebar
---
import { Playground, PropsTable } from 'docz'
import { SidebarComponent } from './index.js'
# Sidebar
<PropsTable of={SidebarComponent} />
## Basic usage
<Playground>
<SidebarComponent />
</Playground>