Skip to content

Commit

Permalink
add Badge docs (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
adammockor authored Feb 10, 2019
1 parent 66200a6 commit 36af9c9
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
42 changes: 42 additions & 0 deletions packages/styleguide/src/components/Badge/Badge.docs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Badge, InfoBadge } from './';
import { Preview, ComponentDocs } from './../';

# Badge

Badges are used to indicate status of an object. It's meant to be used inline to highlight important information.

## Variants

### Default

<Preview>
<Badge>Badge</Badge>
</Preview>

### Colored badges

<Preview>
<Badge>Badge</Badge>
<Badge color="accent">Accent</Badge><br />
<Badge color="success">Success</Badge><br />
<Badge color="error">Error</Badge><br />
<Badge color="info">Info</Badge><br />
</Preview>

### InfoBadge

<Preview>
<InfoBadge value="ready" /><br />
<InfoBadge value="wip" /><br />
<InfoBadge value="deprecated" /><br />
<InfoBadge value="draft" /><br />
<InfoBadge value="custom" /><br />
<InfoBadge value="universal" /><br />
<InfoBadge value="react" /><br />
<InfoBadge value="html" /><br />
</Preview>

## Props

<ComponentDocs title="<Badge />" component={Badge} />
<ComponentDocs title="<InfoBadge />" component={InfoBadge} />
1 change: 1 addition & 0 deletions packages/styleguide/src/components/Badge/Badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styled from 'styled-components';
import { rem } from './../../style/utils';

const propTypes = {
/** Color as a string from styleguide theme */
color: string
};

Expand Down
2 changes: 2 additions & 0 deletions packages/styleguide/src/components/Badge/InfoBadge.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ let defaultTypeToColorMap = {
};

const propTypes = {
/** Value is key from `typeToColorMap` prop. */
value: string,
/** Default map of available states. */
typeToColorMap: object
};

Expand Down
6 changes: 6 additions & 0 deletions packages/styleguide/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import PreviewDocs from './components/Preview/Preview.docs.mdx';
import ComponentDocsDocs from './components/ComponentDocs/ComponentDocs.docs.mdx';
import CodeDocs from './components/Code/Code.docs.mdx';
import ColorPaletteDocs from './components/ColorPalette/ColorPalette.docs.mdx';
import BadgeDocs from './components/Badge/Badge.docs.mdx';

styleguide({
config: {
Expand All @@ -31,6 +32,11 @@ styleguide({
title: 'Components',
path: '/components',
nodes: [
{
title: 'Badge',
path: '/badge',
render: <Page render={BadgeDocs} />
},
{
title: 'Code',
path: '/code',
Expand Down

0 comments on commit 36af9c9

Please sign in to comment.