strapi-generate-plugin
Advanced tools
Comparing version 3.0.0-alpha.5.5 to 3.0.0-alpha.6
@@ -8,2 +8,3 @@ /** | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
@@ -24,5 +25,5 @@ import styles from './styles.scss'; | ||
Button.propTypes = { | ||
label: React.PropTypes.string.isRequired, | ||
label: PropTypes.string.isRequired, | ||
}; | ||
export default Button; |
@@ -9,4 +9,10 @@ /** | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { connect } from 'react-redux'; | ||
import { createStructuredSelector } from 'reselect'; | ||
import { Switch, Route } from 'react-router-dom'; | ||
import { compose } from 'redux'; | ||
import HomePage from 'containers/HomePage'; | ||
import { pluginId } from 'app'; | ||
@@ -16,12 +22,7 @@ | ||
render() { | ||
// Assign plugin component to children | ||
const content = React.Children.map(this.props.children, child => | ||
React.cloneElement(child, { | ||
exposedComponents: this.props.exposedComponents, | ||
}) | ||
); | ||
return ( | ||
<div className={pluginId}> | ||
{React.Children.toArray(content)} | ||
<Switch> | ||
<Route path="" component={HomePage} exact /> | ||
</Switch> | ||
</div> | ||
@@ -32,9 +33,4 @@ ); | ||
App.contextTypes = { | ||
router: React.PropTypes.object.isRequired, | ||
}; | ||
App.propTypes = { | ||
children: React.PropTypes.node.isRequired, | ||
exposedComponents: React.PropTypes.object.isRequired, | ||
match: PropTypes.object, | ||
}; | ||
@@ -51,2 +47,6 @@ | ||
// Wrap the component to inject dispatch and state into it | ||
export default connect(mapStateToProps, mapDispatchToProps)(App); | ||
const withConnect = connect(mapStateToProps, mapDispatchToProps); | ||
export default compose( | ||
withConnect, | ||
)(App); |
@@ -9,18 +9,2 @@ // import { createSelector } from 'reselect'; | ||
const selectLocationState = () => { | ||
let prevRoutingState; | ||
let prevRoutingStateJS; | ||
return state => { | ||
const routingState = state.get('route'); // or state.route | ||
if (!routingState.equals(prevRoutingState)) { | ||
prevRoutingState = routingState; | ||
prevRoutingStateJS = routingState.toJS(); | ||
} | ||
return prevRoutingStateJS; | ||
}; | ||
}; | ||
export { selectLocationState }; | ||
export {}; |
@@ -8,6 +8,11 @@ /* | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { connect } from 'react-redux'; | ||
import { createStructuredSelector } from 'reselect'; | ||
import { injectIntl } from 'react-intl'; | ||
import { pluginId, pluginName, pluginDescription } from 'app'; | ||
import { compose } from 'redux'; | ||
import injectReducer from 'utils/injectReducer'; | ||
import injectSaga from 'utils/injectSaga'; | ||
import Button from 'components/Button'; | ||
@@ -18,2 +23,4 @@ | ||
import { makeSelectLoading, makeSelectData } from './selectors'; | ||
import reducer from './reducer'; | ||
import saga from './saga'; | ||
@@ -39,19 +46,4 @@ export class HomePage extends React.Component { | ||
// Plugin header config | ||
const PluginHeader = this.props.exposedComponents.PluginHeader; | ||
const pluginHeaderTitle = pluginName; | ||
const pluginHeaderDescription = pluginDescription; | ||
return ( | ||
<div className={styles.homePage}> | ||
<PluginHeader | ||
title={{ | ||
id: `${pluginId}-title`, | ||
defaultMessage: pluginHeaderTitle, | ||
}} | ||
description={{ | ||
id: `${pluginId}-description`, | ||
defaultMessage: pluginHeaderDescription, | ||
}} | ||
/> | ||
<div className="row"> | ||
@@ -75,13 +67,13 @@ <div className="col-md-12"> | ||
HomePage.contextTypes = { | ||
router: React.PropTypes.object.isRequired, | ||
router: PropTypes.object, | ||
}; | ||
HomePage.propTypes = { | ||
data: React.PropTypes.oneOfType([ | ||
React.PropTypes.bool, | ||
React.PropTypes.object, | ||
data: PropTypes.oneOfType([ | ||
PropTypes.bool, | ||
PropTypes.object, | ||
]), | ||
exposedComponents: React.PropTypes.object.isRequired, | ||
loadData: React.PropTypes.func.isRequired, | ||
loading: React.PropTypes.bool.isRequired, | ||
exposedComponents: PropTypes.object, | ||
loadData: PropTypes.func, | ||
loading: PropTypes.bool, | ||
}; | ||
@@ -101,4 +93,11 @@ | ||
export default connect(mapStateToProps, mapDispatchToProps)( | ||
injectIntl(HomePage) | ||
); | ||
const withConnect = connect(mapStateToProps, mapDispatchToProps); | ||
const withReducer = injectReducer({ key: 'homePage', reducer }); | ||
const withSaga = injectSaga({ key: 'homePage', saga }); | ||
export default compose( | ||
withReducer, | ||
withSaga, | ||
withConnect, | ||
)(injectIntl(HomePage)); |
@@ -36,3 +36,3 @@ 'use strict'; | ||
'start': 'cross-env NODE_ENV=development node node_modules/strapi-helper-plugin/lib/server', | ||
'generate': 'node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js', | ||
'generate': 'plop --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js', | ||
'lint': 'eslint --ignore-path .gitignore --config node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin', | ||
@@ -39,0 +39,0 @@ 'pretest': 'npm run lint', |
{ | ||
"name": "strapi-generate-plugin", | ||
"version": "3.0.0-alpha.5.5", | ||
"version": "3.0.0-alpha.6", | ||
"description": "Generate an plugin for a Strapi application.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://strapi.io", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19323
34
409