Skip to content

Commit

Permalink
relax elements decorator wireframe
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno12mota committed Dec 15, 2016
1 parent 0411bfe commit 6293414
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
45 changes: 45 additions & 0 deletions lib/shared/decorators/relax-element.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import hoistStatics from 'hoist-non-react-statics';
import React, {Component, PropTypes} from 'react';
import {connect} from 'react-redux';

/**
* Relax Elements Decorator
*
*/
export default function dataConnect (...args) {

return function wrapWithDataConnect (WrappedElement) {

@connect(
(state) => {
var result = {};

// element


return result;
}
)
class ConnectData extends Component {
static propTypes = {
id: PropTypes.string.isRequired,
context: PropTypes.string.isRequired
};

constructor (props, context) {
super(props, context);

// for debugging
this.constructor.displayName = WrappedElement.name;
}

render () {
return (
<WrappedElement />
);
}
}

return hoistStatics(ConnectData, WrappedElement);
};
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"graphql": "^0.4.7",
"graphql-type-json": "^0.1.2",
"history": "1.17.0",
"hoist-non-react-statics": "^1.0.3",
"hoist-non-react-statics": "^1.2.0",
"invariant": "^2.2.0",
"js-md5": "^0.3.0",
"kerberos": "^0.0.21",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2415,7 +2415,7 @@ [email protected]:
version "2.16.3"
resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed"

hoist-non-react-statics@^1.0.3, hoist-non-react-statics@^1.1.0, hoist-non-react-statics@^1.2.0:
hoist-non-react-statics, hoist-non-react-statics@^1.0.3, hoist-non-react-statics@^1.1.0, hoist-non-react-statics@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz#aa448cf0986d55cc40773b17174b7dd066cb7cfb"

Expand Down

0 comments on commit 6293414

Please sign in to comment.