@kadira/react-storybook-addon-info
Advanced tools
Comparing version 3.1.4 to 3.2.0
# Change Log | ||
### 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 | ||
@@ -4,0 +9,0 @@ |
@@ -59,23 +59,8 @@ 'use strict'; | ||
var _theme = require('./theme'); | ||
var _markdown = require('./markdown'); | ||
var _theme = require('./theme'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
_markdownToReactComponents2.default.configure({ | ||
h1: _markdown.H1, | ||
h2: _markdown.H2, | ||
h3: _markdown.H3, | ||
h4: _markdown.H4, | ||
h5: _markdown.H5, | ||
h6: _markdown.H6, | ||
code: _markdown.Code, | ||
// pre: Pre, | ||
p: _markdown.P, | ||
a: _markdown.A, | ||
li: _markdown.LI, | ||
ul: _markdown.UL | ||
}); | ||
var stylesheet = { | ||
@@ -167,2 +152,3 @@ link: { | ||
_this.state = { open: false }; | ||
_markdownToReactComponents2.default.configure(_this.props.mtrcConf); | ||
return _this; | ||
@@ -443,3 +429,4 @@ } | ||
showSource: _react2.default.PropTypes.bool, | ||
children: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.object, _react2.default.PropTypes.array]) | ||
children: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.object, _react2.default.PropTypes.array]), | ||
mtrcConf: _react2.default.PropTypes.object | ||
}; | ||
@@ -450,3 +437,4 @@ | ||
showHeader: true, | ||
showSource: true | ||
showSource: true, | ||
mtrcConf: {} | ||
}; |
@@ -8,2 +8,6 @@ 'use strict'; | ||
var _assign = require('babel-runtime/core-js/object/assign'); | ||
var _assign2 = _interopRequireDefault(_assign); | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
@@ -21,2 +25,4 @@ | ||
var _markdown = require('./components/markdown'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -29,7 +35,23 @@ | ||
header: true, | ||
source: true | ||
source: true, | ||
propTables: [] | ||
}; | ||
var defaultMtrcConf = { | ||
h1: _markdown.H1, | ||
h2: _markdown.H2, | ||
h3: _markdown.H3, | ||
h4: _markdown.H4, | ||
h5: _markdown.H5, | ||
h6: _markdown.H6, | ||
code: _markdown.Code, | ||
p: _markdown.P, | ||
a: _markdown.A, | ||
li: _markdown.LI, | ||
ul: _markdown.UL | ||
}; | ||
exports.default = { | ||
addWithInfo: function addWithInfo(storyName, info, storyFn, _options) { | ||
if (typeof storyFn !== 'function') { | ||
@@ -54,2 +76,7 @@ if (typeof info === 'function') { | ||
var mtrcConf = (0, _extends3.default)({}, defaultMtrcConf); | ||
if (_options && _options.mtrcConf) { | ||
(0, _assign2.default)(mtrcConf, _options.mtrcConf); | ||
} | ||
this.add(storyName, function (context) { | ||
@@ -62,3 +89,4 @@ var props = { | ||
showSource: Boolean(options.source), | ||
propTables: options.propTables | ||
propTables: options.propTables, | ||
mtrcConf: mtrcConf | ||
}; | ||
@@ -65,0 +93,0 @@ |
{ | ||
"name": "@kadira/react-storybook-addon-info", | ||
"version": "3.1.4", | ||
"version": "3.2.0", | ||
"description": "A React Storybook addon to show additional information for your stories.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -5,20 +5,5 @@ import React from 'react'; | ||
import Node from './Node'; | ||
import { H1, H2, H3, H4, H5, H6, Code, Pre, P, UL, A, LI } from './markdown'; | ||
import { baseFonts } from './theme'; | ||
import { Pre } from './markdown'; | ||
MTRC.configure({ | ||
h1: H1, | ||
h2: H2, | ||
h3: H3, | ||
h4: H4, | ||
h5: H5, | ||
h6: H6, | ||
code: Code, | ||
// pre: Pre, | ||
p: P, | ||
a: A, | ||
li: LI, | ||
ul: UL, | ||
}); | ||
const stylesheet = { | ||
@@ -100,2 +85,3 @@ link: { | ||
this.state = { open: false }; | ||
MTRC.configure(this.props.mtrcConf); | ||
} | ||
@@ -314,2 +300,3 @@ | ||
]), | ||
mtrcConf: React.PropTypes.object | ||
}; | ||
@@ -321,2 +308,3 @@ | ||
showSource: true, | ||
mtrcConf: {} | ||
}; |
import React from 'react'; | ||
import _Story from './components/Story'; | ||
import { H1, H2, H3, H4, H5, H6, Code, P, UL, A, LI } from './components/markdown'; | ||
export const Story = _Story; | ||
@@ -9,6 +10,22 @@ | ||
source: true, | ||
propTables: [], | ||
}; | ||
const defaultMtrcConf = { | ||
h1: H1, | ||
h2: H2, | ||
h3: H3, | ||
h4: H4, | ||
h5: H5, | ||
h6: H6, | ||
code: Code, | ||
p: P, | ||
a: A, | ||
li: LI, | ||
ul: UL, | ||
}; | ||
export default { | ||
addWithInfo(storyName, info, storyFn, _options) { | ||
if (typeof storyFn !== 'function') { | ||
@@ -36,2 +53,7 @@ if (typeof info === 'function') { | ||
const mtrcConf = { ...defaultMtrcConf }; | ||
if (_options && _options.mtrcConf) { | ||
Object.assign(mtrcConf, _options.mtrcConf); | ||
} | ||
this.add(storyName, (context) => { | ||
@@ -45,2 +67,3 @@ const props = { | ||
propTables: options.propTables, | ||
mtrcConf | ||
}; | ||
@@ -47,0 +70,0 @@ |
275509
2475