feature: add docz usage example
This commit is contained in:
parent
1a439cc6a5
commit
6b1a1414af
|
@ -8,17 +8,26 @@ import { styles } from './styles';
|
||||||
|
|
||||||
// TODO: Not sure this is the best approach to styling
|
// TODO: Not sure this is the best approach to styling
|
||||||
// in a StyledComponents-powered application
|
// 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>
|
<Wrapper>
|
||||||
{MENU_OPTIONS.map(item => (
|
{(options || []).map(item => (
|
||||||
<Link
|
<Link key={item.route} to={item.route}>
|
||||||
key={item.route}
|
|
||||||
to={item.route}
|
|
||||||
>
|
|
||||||
{item.label}
|
{item.label}
|
||||||
</Link>
|
</Link>
|
||||||
))}
|
))}
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
SidebarComponent.defaultProps = {
|
||||||
|
options: MENU_OPTIONS,
|
||||||
|
};
|
||||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue