From 6baa56d9a14693f4632231b82097679a5d64b4a7 Mon Sep 17 00:00:00 2001 From: Virginie Ky Date: Thu, 28 Nov 2019 15:11:57 +0100 Subject: [PATCH] PR review apply --- .../DraggedFieldWithPreview/DynamicComponent.js | 15 +++++---------- .../admin/src/components/DynamicZone/index.js | 1 - 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/packages/strapi-plugin-content-manager/admin/src/components/DraggedFieldWithPreview/DynamicComponent.js b/packages/strapi-plugin-content-manager/admin/src/components/DraggedFieldWithPreview/DynamicComponent.js index c60a93a957..6f35196b1a 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/DraggedFieldWithPreview/DynamicComponent.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/DraggedFieldWithPreview/DynamicComponent.js @@ -1,16 +1,14 @@ import React, { useState } from 'react'; -import { withRouter } from 'react-router-dom'; +import { useHistory } from 'react-router-dom'; import PropTypes from 'prop-types'; import pluginId from '../../pluginId'; import DynamicComponentCard from '../DynamicComponentCard'; import Tooltip from './Tooltip'; -const DynamicComponent = ({ - componentUid, - history: { push }, - setIsOverDynamicZone, -}) => { +const DynamicComponent = ({ componentUid, setIsOverDynamicZone }) => { const [state, setState] = useState(false); + const { push } = useHistory(); + const handleMouseEvent = () => { setIsOverDynamicZone(v => !v); setState(v => !v); @@ -35,10 +33,7 @@ const DynamicComponent = ({ DynamicComponent.propTypes = { componentUid: PropTypes.string.isRequired, - history: PropTypes.shape({ - push: PropTypes.func.isRequired, - }), setIsOverDynamicZone: PropTypes.func.isRequired, }; -export default withRouter(DynamicComponent); +export default DynamicComponent; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/DynamicZone/index.js b/packages/strapi-plugin-content-manager/admin/src/components/DynamicZone/index.js index 7853e75e80..748323071c 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/DynamicZone/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/DynamicZone/index.js @@ -1,5 +1,4 @@ import React, { useCallback, useState } from 'react'; - import { get } from 'lodash'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl';