mirror of https://github.com/apache/superset.git
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
This commit is contained in:
parent
9f678e55b9
commit
d409d68e7f
|
@ -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;
|
Loading…
Reference in New Issue