This repository has been archived by the owner on Nov 10, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from storybooks/add-addonsinfo-repo
Add addonsinfo repo
- Loading branch information
Showing
32 changed files
with
1,545 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.babelrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["es2015", "stage-2", "react"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// IMPORTANT | ||
// --------- | ||
// This is an auto generated file with React CDK. | ||
// Do not modify this file. | ||
|
||
const parse = require('git-url-parse'); | ||
var ghUrl = process.argv[2]; | ||
const parsedUrl = parse(ghUrl); | ||
|
||
const ghPagesUrl = 'https://' + parsedUrl.owner + '.github.io/' + parsedUrl.name; | ||
console.log(ghPagesUrl); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// IMPORTANT | ||
// --------- | ||
// This is an auto generated file with React CDK. | ||
// Do not modify this file. | ||
// Use `.scripts/user/pretest.js instead`. | ||
|
||
require('babel-core/register'); | ||
require('babel-polyfill'); | ||
|
||
// Add jsdom support, which is required for enzyme. | ||
var jsdom = require('jsdom').jsdom; | ||
|
||
var exposedProperties = ['window', 'navigator', 'document']; | ||
|
||
global.document = jsdom(''); | ||
global.window = document.defaultView; | ||
Object.keys(document.defaultView).forEach((property) => { | ||
if (typeof global[property] === 'undefined') { | ||
exposedProperties.push(property); | ||
global[property] = document.defaultView[property]; | ||
} | ||
}); | ||
|
||
global.navigator = { | ||
userAgent: 'node.js' | ||
}; | ||
|
||
process.on('unhandledRejection', function (error) { | ||
console.error('Unhandled Promise Rejection:'); | ||
console.error(error && error.stack || error); | ||
}); | ||
|
||
require('./user/pretest.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
# IMPORTANT | ||
# --------- | ||
# This is an auto generated file with React CDK. | ||
# Do not modify this file. | ||
# Use `.scripts/user/prepublish.sh instead`. | ||
|
||
echo "=> Transpiling 'src' into ES5 ..." | ||
echo "" | ||
rm -rf ./dist | ||
./node_modules/.bin/babel --ignore tests,stories --plugins "transform-runtime" ./src --out-dir ./dist | ||
echo "" | ||
echo "=> Transpiling completed." | ||
|
||
. .scripts/user/prepublish.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
# IMPORTANT | ||
# --------- | ||
# This is an auto generated file with React CDK. | ||
# Do not modify this file. | ||
|
||
set -e # exit with nonzero exit code if anything fails | ||
|
||
# get GIT url | ||
|
||
GIT_URL=`git config --get remote.origin.url` | ||
if [[ $GIT_URL == "" ]]; then | ||
echo "This project is not configured with a remote git repo". | ||
exit 1 | ||
fi | ||
|
||
# clear and re-create the out directory | ||
rm -rf .out || exit 0; | ||
mkdir .out; | ||
|
||
# run our compile script, discussed above | ||
build-storybook -o .out | ||
|
||
# go to the out directory and create a *new* Git repo | ||
cd .out | ||
git init | ||
|
||
# inside this git repo we'll pretend to be a new user | ||
git config user.name "GH Pages Bot" | ||
git config user.email "[email protected]" | ||
|
||
# The first and only commit to this new Git repo contains all the | ||
# files present with the commit message "Deploy to GitHub Pages". | ||
git add . | ||
git commit -m "Deploy Storybook to GitHub Pages" | ||
|
||
# Force push from the current repo's master branch to the remote | ||
# repo's gh-pages branch. (All previous history on the gh-pages branch | ||
# will be lost, since we are overwriting it.) We redirect any output to | ||
# /dev/null to hide any sensitive credential data that might otherwise be exposed. | ||
git push --force --quiet $GIT_URL master:gh-pages > /dev/null 2>&1 | ||
cd .. | ||
rm -rf .out | ||
|
||
echo "" | ||
echo "=> Storybook deployed to: `node .scripts/get_gh_pages_url.js $GIT_URL`" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Use this file to your own code to run at NPM `prepublish` event. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Use this file to setup any test utilities. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import '@kadira/storybook/addons'; | ||
import 'react-storybook-addon-backgrounds/register'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import { configure, setAddon, addDecorator } from '@kadira/storybook'; | ||
import InfoAddon from '../src/'; | ||
|
||
addDecorator((story) => ( | ||
<div style={{padding: 20}}> | ||
{story()} | ||
</div> | ||
)); | ||
|
||
setAddon(InfoAddon); | ||
|
||
configure(function () { | ||
require('../example/story'); | ||
}, module); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = function (config) { | ||
// This is the default webpack config defined in the `../webpack.config.js` | ||
// modify as you need. | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// IMPORTANT | ||
// --------- | ||
// This is an auto generated file with React CDK. | ||
// Do not modify this file. | ||
// Use `.storybook/user/modify_webpack_config.js instead`. | ||
|
||
const path = require('path'); | ||
const updateConfig = require('./user/modify_webpack_config'); | ||
|
||
const config = { | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.css?$/, | ||
loaders: ['style', 'raw'], | ||
include: path.resolve(__dirname, '../'), | ||
}, | ||
{ | ||
test: /\.json?$/, | ||
loaders: ['json'], | ||
include: path.resolve(__dirname, '../'), | ||
} | ||
], | ||
}, | ||
}; | ||
|
||
updateConfig(config); | ||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Change Log | ||
|
||
### v3.3.0 | ||
|
||
* Add setDefaults function [PR114](https://github.com/kadirahq/react-storybook-addon-info/pull/114) | ||
|
||
### v3.2.4 | ||
|
||
* Add missing dist files [PR113](https://github.com/kadirahq/react-storybook-addon-info/pull/113) | ||
|
||
### v3.2.3 | ||
|
||
* Handle number type nodes [PR110](https://github.com/kadirahq/react-storybook-addon-info/pull/110) | ||
|
||
### v3.2.2 | ||
|
||
* Use markdown-to-react-components npm package instead of our fork. Our PR to them is merged and published. [PR109](https://github.com/kadirahq/react-storybook-addon-info/pull/109) | ||
|
||
### v3.2.1 | ||
|
||
* Handle false values for types [PR54](https://github.com/kadirahq/react-storybook-addon-info/pull/54) | ||
|
||
### v3.2.0 | ||
|
||
* Support custom MTRC config [PR54](https://github.com/kadirahq/react-storybook-addon-info/pull/54) | ||
* Fix propTables prop validation with a default value [PR55](https://github.com/kadirahq/react-storybook-addon-info/pull/55) | ||
|
||
### v3.1.4 | ||
|
||
* Remove propTables prop validation warning [PR53](https://github.com/kadirahq/react-storybook-addon-info/pull/53) | ||
* Update example storybook [PR52](https://github.com/kadirahq/react-storybook-addon-info/pull/52) | ||
|
||
### v3.1.3 | ||
|
||
* Fix wrong detection of propType when isRequired is set [PR49](https://github.com/kadirahq/react-storybook-addon-info/pull/49) | ||
* Add displayName for Button [PR51](https://github.com/kadirahq/react-storybook-addon-info/pull/51) | ||
|
||
### v3.1.2 | ||
|
||
* Fixed a bug which made the `info` to not display and the `options` parameter to be ignored when `info` is not given.[PR45](https://github.com/kadirahq/react-storybook-addon-info/pull/45) | ||
|
||
### v3.1.1 | ||
|
||
* Add a z-index for rendered items to make the overlay always display on top [PR38](https://github.com/kadirahq/react-storybook-addon-info/pull/38) | ||
|
||
### v3.1.0 | ||
|
||
* Make the `info` argument optional [PR37](https://github.com/kadirahq/react-storybook-addon-info/pull/37) | ||
|
||
### v3.0.10 | ||
|
||
* Render the component inside a div element when on inline mode [PR34](https://github.com/kadirahq/react-storybook-addon-info/pull/34) | ||
|
||
### v3.0.9 | ||
|
||
* Add missing `@kadira/storybook` devDependencies [PR25](https://github.com/kadirahq/react-storybook-addon-info/pull/25) | ||
* Improve prop rendering in jsx source view [PR24](https://github.com/kadirahq/react-storybook-addon-info/pull/24) | ||
* Avoid warning message with "webkitFontSmoothing" [PR30](https://github.com/kadirahq/react-storybook-addon-info/pull/30) | ||
* Remove max-width style rule for wrapper [PR31](https://github.com/kadirahq/react-storybook-addon-info/pull/31) and [PR36](https://github.com/kadirahq/react-storybook-addon-info/pull/36) | ||
* Improve prop table rendering (handle css resets) [PR32](https://github.com/kadirahq/react-storybook-addon-info/pull/32) | ||
|
||
### v3.0.8 | ||
|
||
* Fixed unkeyed array iteration warning in React with: [PR23](https://github.com/kadirahq/react-storybook-addon-info/pull/23) | ||
|
||
### v3.0.7 | ||
|
||
* Improve default display in prop table. See [#16](https://github.com/kadirahq/react-storybook-addon-info/pull/16) | ||
|
||
### v3.0.6 | ||
|
||
* Improve function type and react element type props display. See [#14](https://github.com/kadirahq/react-storybook-addon-info/pull/14) | ||
|
||
### v3.0.5 | ||
|
||
* Over-indentation of ending tag in source code is fixed. See [#13](https://github.com/kadirahq/react-storybook-addon-info/pull/13) | ||
|
||
### v3.0.4 | ||
|
||
* Remove the need to use json-loader with webpack when using this package. | ||
See: [#12](https://github.com/kadirahq/react-storybook-addon-info/issues/12) | ||
|
||
### v3.0.0 | ||
|
||
* Add the version which works as an React Storybook addon. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Contributing to React Storybook Story Component | ||
|
||
We welcome your help to make this component better. This document will help to streamline the contributing process and save everyone's precious time. | ||
|
||
## Development Setup | ||
|
||
This component has been setup with [React CDK](https://github.com/kadirahq/react-cdk). Refer [React CDK documentation](https://github.com/kadirahq/react-cdk)) to get started with the development. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Your Name. <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# React Storybook Info Addon | ||
|
||
A React Storybook addon to show additional information for your stories. | ||
|
||
![React Storybook Screenshot](docs/home-screenshot.png) | ||
|
||
## Usage | ||
|
||
Install the following npm module: | ||
|
||
```sh | ||
npm i -D @kadira/react-storybook-addon-info | ||
``` | ||
|
||
Then set the addon in the place you configure storybook like this: | ||
|
||
```js | ||
import { configure, setAddon } from '@kadira/storybook'; | ||
import infoAddon from '@kadira/react-storybook-addon-info'; | ||
|
||
setAddon(infoAddon); | ||
|
||
configure(function () { | ||
... | ||
}, module); | ||
``` | ||
|
||
Then create your stories with the `.addWithInfo` API. | ||
|
||
```js | ||
import React from 'react'; | ||
import Button from './Button'; | ||
import { storiesOf, action } from '@kadira/storybook'; | ||
|
||
storiesOf('Button') | ||
.addWithInfo( | ||
'simple usage', | ||
` | ||
This is the basic usage with the button with providing a label to show the text. | ||
`, | ||
() => ( | ||
<div> | ||
<Button label="The Button" onClick={action('onClick')}/> | ||
<br /> | ||
<p> | ||
Click the "?" mark at top-right to view the info. | ||
</p> | ||
</div> | ||
), | ||
); | ||
``` | ||
|
||
> Have a look at [this example](example/story.js) stories to learn more about the `addWithInfo` API. | ||
## The FAQ | ||
|
||
**Components lose their names on static build** | ||
|
||
Component names also get minified with other javascript code when building for production. When creating components, set the `displayName` static property to show the correct component name on static builds. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
|
||
const Button = ({ disabled, label, style, onClick }) => ( | ||
<button disabled={disabled} onClick={onClick}> | ||
{label} | ||
</button> | ||
); | ||
|
||
Object.assign(Button, { | ||
displayName: 'Button', | ||
propTypes: { | ||
label: React.PropTypes.string.isRequired, | ||
style: React.PropTypes.object, | ||
disabled: React.PropTypes.bool, | ||
onClick: React.PropTypes.func | ||
} | ||
}); | ||
|
||
export default Button; |
Oops, something went wrong.