Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: migrate DeleteComponentButton to TypeScript #18136

Merged
merged 6 commits into from
Feb 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Scrip7 marked this conversation as resolved.
Show resolved Hide resolved
};

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;