-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
now only inject docgen info to exported components
- Loading branch information
1 parent
94ff6e5
commit 2234134
Showing
12 changed files
with
354 additions
and
19 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
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
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
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
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
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,55 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
var _react = require('react'); | ||
|
||
var _react2 = _interopRequireDefault(_react); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
var Second = function Second() { | ||
return _react2.default.createElement( | ||
'div', | ||
null, | ||
'Sample' | ||
); | ||
}; | ||
|
||
var First = function First(_ref) { | ||
var children = _ref.children; | ||
return _react2.default.createElement( | ||
'div', | ||
null, | ||
children, | ||
_react2.default.createElement(Second, null) | ||
); | ||
}; | ||
|
||
First.propTypes = { | ||
children: _react.PropTypes.node | ||
}; | ||
|
||
exports.default = First; | ||
First.__docgenInfo = { | ||
description: '', | ||
props: { | ||
children: { | ||
type: { | ||
name: 'node' | ||
}, | ||
required: false, | ||
description: '' | ||
} | ||
} | ||
}; | ||
|
||
if (typeof STORYBOOK_REACT_CLASSES !== 'undefined') { | ||
STORYBOOK_REACT_CLASSES['test/fixtures/case5/actual.js'] = { | ||
name: 'First', | ||
docgenInfo: First.__docgenInfo, | ||
path: 'test/fixtures/case5/actual.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,17 @@ | ||
import React from 'react'; | ||
export function hoc (Inner) { | ||
const C1 = (props) => <ActualC1 {...props} /> | ||
const C2 = (props) => <ActualC2 {...props} /> | ||
return { | ||
C1, | ||
C2 | ||
} | ||
} | ||
|
||
class ActualC1 extends React.Component { | ||
render() { return <div/> } | ||
} | ||
|
||
class ActualC2 extends React.Component { | ||
render() { return <div/> } | ||
} |
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,72 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
|
||
exports.hoc = hoc; | ||
|
||
var _react = require('react'); | ||
|
||
var _react2 = _interopRequireDefault(_react); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
|
||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
|
||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
|
||
function hoc(Inner) { | ||
var C1 = function C1(props) { | ||
return _react2.default.createElement(ActualC1, props); | ||
}; | ||
var C2 = function C2(props) { | ||
return _react2.default.createElement(ActualC2, props); | ||
}; | ||
return { | ||
C1: C1, | ||
C2: C2 | ||
}; | ||
} | ||
|
||
var ActualC1 = function (_React$Component) { | ||
_inherits(ActualC1, _React$Component); | ||
|
||
function ActualC1() { | ||
_classCallCheck(this, ActualC1); | ||
|
||
return _possibleConstructorReturn(this, (ActualC1.__proto__ || Object.getPrototypeOf(ActualC1)).apply(this, arguments)); | ||
} | ||
|
||
_createClass(ActualC1, [{ | ||
key: 'render', | ||
value: function render() { | ||
return _react2.default.createElement('div', null); | ||
} | ||
}]); | ||
|
||
return ActualC1; | ||
}(_react2.default.Component); | ||
|
||
var ActualC2 = function (_React$Component2) { | ||
_inherits(ActualC2, _React$Component2); | ||
|
||
function ActualC2() { | ||
_classCallCheck(this, ActualC2); | ||
|
||
return _possibleConstructorReturn(this, (ActualC2.__proto__ || Object.getPrototypeOf(ActualC2)).apply(this, arguments)); | ||
} | ||
|
||
_createClass(ActualC2, [{ | ||
key: 'render', | ||
value: function render() { | ||
return _react2.default.createElement('div', null); | ||
} | ||
}]); | ||
|
||
return ActualC2; | ||
}(_react2.default.Component); |
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,18 @@ | ||
import React, { PropTypes } from 'react' | ||
|
||
const Second = () => ( | ||
<div>Sample</div> | ||
) | ||
|
||
const First = ({ children }) => ( | ||
<div> | ||
{ children } | ||
<Second /> | ||
</div> | ||
) | ||
|
||
First.propTypes = { | ||
children: PropTypes.node | ||
} | ||
|
||
export {First} |
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,56 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.First = undefined; | ||
|
||
var _react = require('react'); | ||
|
||
var _react2 = _interopRequireDefault(_react); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
var Second = function Second() { | ||
return _react2.default.createElement( | ||
'div', | ||
null, | ||
'Sample' | ||
); | ||
}; | ||
|
||
var First = function First(_ref) { | ||
var children = _ref.children; | ||
return _react2.default.createElement( | ||
'div', | ||
null, | ||
children, | ||
_react2.default.createElement(Second, null) | ||
); | ||
}; | ||
|
||
First.propTypes = { | ||
children: _react.PropTypes.node | ||
}; | ||
|
||
exports.First = First; | ||
First.__docgenInfo = { | ||
description: '', | ||
props: { | ||
children: { | ||
type: { | ||
name: 'node' | ||
}, | ||
required: false, | ||
description: '' | ||
} | ||
} | ||
}; | ||
|
||
if (typeof STORYBOOK_REACT_CLASSES !== 'undefined') { | ||
STORYBOOK_REACT_CLASSES['test/fixtures/case7/actual.js'] = { | ||
name: 'First', | ||
docgenInfo: First.__docgenInfo, | ||
path: 'test/fixtures/case7/actual.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,26 @@ | ||
import React from 'react'; | ||
|
||
export const wrapComopnent = (Component) => { | ||
const WrappedComponent = props => ( | ||
<Wrapper> | ||
<Component/> | ||
</Wrapper> | ||
); | ||
return WrappedComponent; | ||
}; | ||
|
||
export class Wrapper extends React.Component { | ||
render() { | ||
const { children } = this.props; | ||
|
||
return ( | ||
<div className="error-box"> | ||
{children} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
Wrapper.propTypes = { | ||
children: React.PropTypes.node.isRequired, | ||
}; |
Oops, something went wrong.