Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Note docs #88

Merged
merged 1 commit into from
Mar 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ Color must be picked from theme.

## Props

<ComponentDocs title="<ComponentInfo />" component={console.log(ComponentInfo.__docgenInfo) || ComponentInfo} />
<ComponentDocs title="<ComponentInfo />" component={ComponentInfo} />
37 changes: 37 additions & 0 deletions packages/styleguide/src/components/Note/Note.docs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import Note from './';
import { Preview, ComponentDocs, Code } from './../';

# Note

Note should be used to display additional or somehow important information with visual indication of type of information.

## Variants

### Default

<Preview>
<Note title="Note title">Note content</Note>
</Preview>

### Note types

<Preview>
<Note title="Info" type="info">Note content</Note>
<Note title="Success" type="success">Note content</Note>
<Note title="Warning" type="warning">Note content</Note>
<Note title="Error" type="error">Note content</Note>
</Preview>

## Props

<ComponentDocs title="<Note />" component={Note} />

## Aliases

<Code inline={false} language="jsx">{`<NoteInfo /> === <Note type="info" />
<NoteSuccess /> === <Note type="success" />
<NoteWarning /> === <Note type="warning" />
<NoteError /> === <Note type="error" />
<Dos /> === <Note type="success" title="Do's" />
<Donts /> === <Note type="error" title="Dont's" />
`}</Code>
7 changes: 4 additions & 3 deletions packages/styleguide/src/components/Note/Note.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import styled from 'styled-components';
import cx from 'classnames';

const propTypes = {
title: string,
/* type influences set styles */
type: oneOf(['warning', 'success', 'error', 'info']),
/** Note title */
title: string.isRequired,
/** Type influences note visal style */
type: oneOf(['warning', 'success', 'error', 'info'])
};

const CLASS_ROOT = 'note';
Expand Down
3 changes: 3 additions & 0 deletions packages/styleguide/src/components/Note/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ NoteError.displayName = 'NoteError';
export const NoteInfo = props => <Note type="info" {...props} />;
NoteInfo.displayName = 'NoteInfo';

export const NoteSuccess = props => <Note type="success" {...props} />;
NoteInfo.displayName = 'NoteSuccess';

export const Dos = props => <Note type="success" title="Do's" {...props} />;
Dos.displayName = 'Dos';

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 @@ -11,6 +11,7 @@ import CodeDocs from './components/Code/Code.docs.mdx';
import ColorPaletteDocs from './components/ColorPalette/ColorPalette.docs.mdx';
import ComponentInfoDocs from './components/ComponentInfo/ComponentInfo.docs.mdx';
import BadgeDocs from './components/Badge/Badge.docs.mdx';
import NoteDocs from './components/Note/Note.docs.mdx';
import TableDocs from './components/Table/Table.docs.mdx';

styleguide({
Expand Down Expand Up @@ -59,6 +60,11 @@ styleguide({
path: '/component-info',
render: <Page render={ComponentInfoDocs} />
},
{
title: 'Note',
path: '/note',
render: <Page render={NoteDocs} />
},
{
title: 'Preview',
path: '/preview',
Expand Down