* removed commented out cruft * added tabIndex prop to delete button (with default=0) * the last change also required a change to the sprite selector test snapshot
40 lines
864 B
React
40 lines
864 B
React
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
import classNames from 'classnames';
|
|
|
|
import styles from './delete-button.css';
|
|
import deleteIcon from './icon--delete.svg';
|
|
|
|
const DeleteButton = props => (
|
|
<div
|
|
aria-label="Delete"
|
|
className={classNames(
|
|
styles.deleteButton,
|
|
props.className
|
|
)}
|
|
role="button"
|
|
tabIndex={props.tabIndex}
|
|
onClick={props.onClick}
|
|
>
|
|
<div className={styles.deleteButtonVisible}>
|
|
<img
|
|
className={styles.deleteIcon}
|
|
src={deleteIcon}
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
);
|
|
|
|
DeleteButton.propTypes = {
|
|
className: PropTypes.string,
|
|
onClick: PropTypes.func.isRequired,
|
|
tabIndex: PropTypes.number
|
|
};
|
|
|
|
DeleteButton.defaultProps = {
|
|
tabIndex: 0
|
|
};
|
|
|
|
export default DeleteButton;
|