@@ -95,7 +128,10 @@ class InstallPluginPopup extends React.Component {
+{this.props.plugin.downloads_nb}k
*/}
+
@@ -110,37 +146,40 @@ class InstallPluginPopup extends React.Component {
{map(this.navLinks, link => {
- const isActive = this.props.history.location.hash.split('::')[1] === link.name;
+ const isActive =
+ this.props.history.location.hash.split('::')[1] === link.name;
return (
{
if (link.name === 'description') {
- this.props.history.push({ pathname: this.props.history.location.pathname, hash: `${this.props.plugin.id}::${link.name}` });
+ this.props.history.push({
+ pathname: this.props.history.location.pathname,
+ hash: `${this.props.plugin.id}::${link.name}`,
+ });
}
}}
- style={isActive ? { paddingTop: '4px'} : { paddingTop: '6px' }}
+ style={
+ isActive ? { paddingTop: '4px' } : { paddingTop: '6px' }
+ }
>
);
})}
-
- {descriptions.long}
-
+
{descriptions.long}
);
}
}
-InstallPluginPopup.contextTypes = {
- downloadPlugin: PropTypes.func.isRequired,
-};
-
InstallPluginPopup.defaultProps = {
description: {
short: 'app.Components.InstallPluginPopup.noDescription',
diff --git a/packages/strapi-admin/admin/src/containers/Marketplace/index.js b/packages/strapi-admin/admin/src/containers/Marketplace/index.js
index 21bd74cee0..ed55356519 100644
--- a/packages/strapi-admin/admin/src/containers/Marketplace/index.js
+++ b/packages/strapi-admin/admin/src/containers/Marketplace/index.js
@@ -13,6 +13,7 @@ import cn from 'classnames';
import { LoadingIndicatorPage, PluginHeader } from 'strapi-helper-plugin';
+import { MarketPlaceContextProvider } from '../../contexts/MarketPlace';
// Design
import PageTitle from '../../components/PageTitle';
import PluginCard from '../../components/PluginCard';
@@ -33,10 +34,6 @@ import saga from './saga';
import styles from './styles.scss';
class Marketplace extends React.Component {
- getChildContext = () => ({
- downloadPlugin: this.props.downloadPlugin,
- });
-
componentDidMount() {
// Fetch the available and installed plugins
this.props.getAvailableAndInstalledPlugins();
@@ -87,29 +84,29 @@ class Marketplace extends React.Component {
}
return (
-
-
- {this.renderHelmet}
-
-
-
-
- {Object.keys(availablePlugins).map(this.renderPluginCard)}
+
+
+
+ {this.renderHelmet}
+
+
+
+
+ {Object.keys(availablePlugins).map(this.renderPluginCard)}
+
-
+
);
}
}
-Marketplace.childContextTypes = {
- downloadPlugin: PropTypes.func.isRequired,
-};
-
Marketplace.defaultProps = {};
Marketplace.propTypes = {
diff --git a/packages/strapi-admin/admin/src/contexts/MarketPlace/index.js b/packages/strapi-admin/admin/src/contexts/MarketPlace/index.js
new file mode 100644
index 0000000000..71a6bef53c
--- /dev/null
+++ b/packages/strapi-admin/admin/src/contexts/MarketPlace/index.js
@@ -0,0 +1,27 @@
+import React, { createContext, useContext } from 'react';
+import PropTypes from 'prop-types';
+
+const MarketPlaceContext = createContext({});
+
+const MarketPlaceContextProvider = ({ children, ...rest }) => {
+ return (
+
+ {children}
+
+ );
+};
+
+const useMarketPlaceContext = () => useContext(MarketPlaceContext);
+
+MarketPlaceContextProvider.defaultProps = {};
+
+MarketPlaceContextProvider.propTypes = {
+ children: PropTypes.node.isRequired,
+ dowloadPlugin: PropTypes.func.isRequired,
+};
+
+export {
+ MarketPlaceContext,
+ MarketPlaceContextProvider,
+ useMarketPlaceContext,
+};