You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by di...@apache.org on 2022/02/11 14:13:43 UTC
[superset] branch master updated: refactor: migrate DeleteComponentButton to TypeScript (#18136)
This is an automated email from the ASF dual-hosted git repository.
diegopucci pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new d409d68 refactor: migrate DeleteComponentButton to TypeScript (#18136)
d409d68 is described below
commit d409d68e7fa41940220099288164711db2db589b
Author: Hesoyam <37...@users.noreply.github.com>
AuthorDate: Fri Feb 11 17:42:19 2022 +0330
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
---
...mponentButton.jsx => DeleteComponentButton.tsx} | 23 +++++++---------------
1 file changed, 7 insertions(+), 16 deletions(-)
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 d3936f3..a030e41 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<HTMLDivElement>;
};
-const defaultProps = {};
+const DeleteComponentButton: React.FC<DeleteComponentButtonProps> = ({
+ onDelete,
+}) => <IconButton onClick={onDelete} icon={<Icons.Trash iconSize="xl" />} />;
-export default class DeleteComponentButton extends React.PureComponent {
- render() {
- const { onDelete } = this.props;
- return (
- <IconButton onClick={onDelete} icon={<Icons.Trash iconSize="xl" />} />
- );
- }
-}
-
-DeleteComponentButton.propTypes = propTypes;
-DeleteComponentButton.defaultProps = defaultProps;
+export default DeleteComponentButton;