From d409d68e7fa41940220099288164711db2db589b Mon Sep 17 00:00:00 2001 From: Hesoyam <37535505+Scrip7@users.noreply.github.com> Date: Fri, 11 Feb 2022 17:42:19 +0330 Subject: [PATCH] refactor: migrate DeleteComponentButton to TypeScript (#18136) * refactor: migrate DeleteComponentButton to TypeScript * chore: fix typings * chore: onDelete default value * chore: removed props export * chore: removed onDelete default value * refactor: functional component --- ...ntButton.jsx => DeleteComponentButton.tsx} | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) rename superset-frontend/src/dashboard/components/{DeleteComponentButton.jsx => DeleteComponentButton.tsx} (65%) diff --git a/superset-frontend/src/dashboard/components/DeleteComponentButton.jsx b/superset-frontend/src/dashboard/components/DeleteComponentButton.tsx similarity index 65% rename from superset-frontend/src/dashboard/components/DeleteComponentButton.jsx rename to superset-frontend/src/dashboard/components/DeleteComponentButton.tsx index d3936f3ed6..a030e41802 100644 --- a/superset-frontend/src/dashboard/components/DeleteComponentButton.jsx +++ b/superset-frontend/src/dashboard/components/DeleteComponentButton.tsx @@ -16,25 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -import React from 'react'; -import PropTypes from 'prop-types'; +import React, { MouseEventHandler } from 'react'; import Icons from 'src/components/Icons'; import IconButton from './IconButton'; -const propTypes = { - onDelete: PropTypes.func.isRequired, +type DeleteComponentButtonProps = { + onDelete: MouseEventHandler; }; -const defaultProps = {}; +const DeleteComponentButton: React.FC = ({ + onDelete, +}) => } />; -export default class DeleteComponentButton extends React.PureComponent { - render() { - const { onDelete } = this.props; - return ( - } /> - ); - } -} - -DeleteComponentButton.propTypes = propTypes; -DeleteComponentButton.defaultProps = defaultProps; +export default DeleteComponentButton;