-
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.
- Loading branch information
1 parent
d87efe4
commit caee408
Showing
2 changed files
with
102 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,24 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { connect } from 'react-redux'; | ||
import { mapStateToProps, mapDispatchToProps } from './testSelector'; | ||
|
||
const TestComponent = (props) => { | ||
const { text, onClick } = props; | ||
|
||
return ( | ||
<div> | ||
<div>Text: {text}</div> | ||
<button onClick={onClick}>Button</button> | ||
</div> | ||
); | ||
}; | ||
|
||
TestComponent.propTypes = { | ||
/** Text to display */ | ||
text: PropTypes.string, | ||
/** Called on click */ | ||
onClick: PropTypes.func | ||
}; | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(TestComponent); |
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,78 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
var _react = require('react'); | ||
|
||
var _react2 = _interopRequireDefault(_react); | ||
|
||
var _propTypes = require('prop-types'); | ||
|
||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
|
||
var _reactRedux = require('react-redux'); | ||
|
||
var _testSelector = require('./testSelector'); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
var TestComponent = function TestComponent(props) { | ||
var text = props.text, | ||
onClick = props.onClick; | ||
|
||
|
||
return _react2.default.createElement( | ||
'div', | ||
null, | ||
_react2.default.createElement( | ||
'div', | ||
null, | ||
'Text: ', | ||
text | ||
), | ||
_react2.default.createElement( | ||
'button', | ||
{ onClick: onClick }, | ||
'Button' | ||
) | ||
); | ||
}; | ||
|
||
TestComponent.propTypes = { | ||
/** Text to display */ | ||
text: _propTypes2.default.string, | ||
/** Called on click */ | ||
onClick: _propTypes2.default.func | ||
}; | ||
|
||
exports.default = (0, _reactRedux.connect)(_testSelector.mapStateToProps, _testSelector.mapDispatchToProps)(TestComponent); | ||
TestComponent.__docgenInfo = { | ||
'description': '', | ||
'methods': [], | ||
'props': { | ||
'text': { | ||
'type': { | ||
'name': 'string' | ||
}, | ||
'required': false, | ||
'description': 'Text to display' | ||
}, | ||
'onClick': { | ||
'type': { | ||
'name': 'func' | ||
}, | ||
'required': false, | ||
'description': 'Called on click' | ||
} | ||
} | ||
}; | ||
|
||
if (typeof STORYBOOK_REACT_CLASSES !== 'undefined') { | ||
STORYBOOK_REACT_CLASSES['test/fixtures/hoc-function/actual.js'] = { | ||
name: 'TestComponent', | ||
docgenInfo: TestComponent.__docgenInfo, | ||
path: 'test/fixtures/hoc-function/actual.js' | ||
}; | ||
} |