Skip to content

Commit ea47c0d

Browse files
committed
docs(storybook): add readme and addons
1 parent 0acb08d commit ea47c0d

File tree

7 files changed

+102
-15
lines changed

7 files changed

+102
-15
lines changed

.storybook/addons.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import '@storybook/addon-options/register';
22
import '@storybook/addon-actions/register';
3+
import '@storybook/addon-a11y/register';

.storybook/config.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1-
import { configure } from '@storybook/react';
1+
import { configure, addDecorator } from '@storybook/react';
22
import { setOptions } from '@storybook/addon-options';
33
import { setDefaults } from '@storybook/addon-info';
4+
import centered from '@storybook/addon-centered';
5+
import { checkA11y } from '@storybook/addon-a11y';
6+
7+
addDecorator(centered);
8+
addDecorator(checkA11y);
49

510
setDefaults({
6-
inline: true,
11+
inline: false,
712
header: true,
813
source: true,
914
});
1015

1116
setTimeout(() => setOptions({
1217
name: 'REACT MADE WITH',
1318
url: 'https://github.com/jaebradley/react-made-with',
14-
showDownPanel: true,
15-
downPanelInRight: true,
19+
showAddonPanel: true,
20+
addonPanelInRight: true,
1621
}), 1000);
1722

1823
function loadStories() {

package-lock.json

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
"@commitlint/config-angular": "^6.1.0",
4040
"@commitlint/prompt": "^6.1.0",
4141
"@commitlint/prompt-cli": "^6.1.0",
42+
"@storybook/addon-a11y": "^3.3.13",
4243
"@storybook/addon-actions": "^3.3.13",
44+
"@storybook/addon-centered": "^3.3.13",
4345
"@storybook/addon-console": "^1.0.0",
4446
"@storybook/addon-info": "^3.3.13",
4547
"@storybook/addon-options": "^3.3.13",

src/MadeWith/MadeWith.stories.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11

22
import React from 'react';
3-
import { storiesOf } from '@storybook/react';
3+
import { storiesOf, addDecorator } from '@storybook/react';
44
import { withInfo } from '@storybook/addon-info';
55
import FontAwesomeIcon from '@fortawesome/react-fontawesome';
66
import { faUserSecret, faPlus } from '@fortawesome/fontawesome-free-solid';
77

88
import MadeWith from './index';
9-
// import README from './README.md';
9+
import README from './README.md';
1010

11-
// const wrapComponent = (component) => (
12-
// withInfo(README)(() => component)
13-
// );
11+
const wrapComponent = (component) => (
12+
withInfo(README)(() => component)
13+
);
1414

1515
storiesOf('Made With', module)
16-
.add('basic usage', () => (
16+
.add('basic usage', wrapComponent(
1717
<MadeWith
1818
love
1919
react
@@ -22,7 +22,7 @@ storiesOf('Made With', module)
2222
}}
2323
/>
2424
))
25-
.add('with email address', () => (
25+
.add('with email address', wrapComponent(
2626
<MadeWith
2727
love
2828
react
@@ -33,7 +33,7 @@ storiesOf('Made With', module)
3333
}}
3434
/>
3535
))
36-
.add('with icon as display', () => (
36+
.add('with icon as display', wrapComponent(
3737
<MadeWith
3838
react
3939
love
@@ -44,7 +44,7 @@ storiesOf('Made With', module)
4444
}}
4545
/>
4646
))
47-
.add('custom separator', () => (
47+
.add('custom separator', wrapComponent(
4848
<MadeWith
4949
love
5050
react

src/MadeWith/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# MadeWith
2+
3+
Component for `Made with` like ![alt-text](https://imgur.com/pWp6tZQ.png)
4+
5+
## API
6+
7+
### `maker (optional; shape)`
8+
9+
Specifies the formatting of the maker
10+
11+
* `identifier (optional; string)`
12+
13+
When specified, is used to format the displayed author.
14+
15+
If no `identifier` is specified, `null` is returned.
16+
17+
When `identifier` receives an email address, it creates a hyperlink with a `mailto` URL (using the given email address) and a trailing [`FontAwesome` `envelope` icon](https://fontawesome.com/icons/envelope?style=solid). The displayed value associated with the `mailto` URL is the `display` prop value or the given email address.
18+
19+
When `identifier` receives a URL, it creates a hyperlink that points to the given URL and a trailing [`FontAwesome` `link` icon](https://fontawesome.com/icons/link?style=solid).
20+
21+
The only exceptions to this are when the URL has a `twitter.com` or `github.com` host, when the icons are the [`FontAwesome` `Twitter` icon](https://fontawesome.com/icons/twitter?style=brands) and the [`FontAwesome` `GitHub` icon](https://fontawesome.com/icons/github?style=brands)
22+
23+
The displayed value associated with the hyperlink is the `display` prop value or the given URL.
24+
25+
If the `identifier` is not an email address or a URL, it is wrapped in a `<span>`, unless the `display` prop is defined.
26+
27+
* `display(optional; string, element)`
28+
29+
When specified, is the displayed value that represents the maker.
30+
31+
* `showIcon (optional; boolean)`
32+
33+
Determines whether or not to show the icon generated by analyzing the `identifier` prop
34+
35+
* `iconColor (optional; string)`
36+
37+
Determines the color of any icon generated by analyzing the `identifier` prop
38+
39+
### `love (optional; boolean)`
40+
41+
Specifies if [the `FontAwesome` `heart` icon](https://fontawesome.com/icons/heart?style=solid) should be used. By default, `false`.
42+
43+
### `react (optional; boolean)`
44+
45+
Specifies if [the `FontAwesome` `react` icon](https://fontawesome.com/icons/heart?style=solid) should be used. By default, `false`.
46+
47+
### `separator (optional; string or element)`
48+
49+
Specifies how each "made with" type is separated. Be default, `and`.
50+
51+
### `className (optional; string)`
52+
53+
Specifies custom class name for component

src/Maker/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Author
1+
# Maker
22

33
Private (i.e API is not publicly exposed) component that determines the maker.
44

55
## API
66

77
### `identifier (optional; string)`
88

9-
When specified, is used to format the displayed author.
9+
When specified, is used to format the displayed maker.
1010

1111
If no `identifier` is specified, `null` is returned.
1212

0 commit comments

Comments
 (0)