| 7 | } |
| 8 | |
| 9 | class DeleteButton extends Component<Props> { |
| 10 | static defaultProps = { |
| 11 | className: '', |
| 12 | } |
| 13 | |
| 14 | get className(): string { |
| 15 | return classNames('btn btn-sm btn-danger', this.props.className) |
| 16 | } |
| 17 | |
| 18 | confirmAndDelete = () => { |
| 19 | // eslint-disable-next-line no-alert |
| 20 | if (!window.confirm('Are you sure you want to delete this item?')) return |
| 21 | this.props.onDelete() |
| 22 | } |
| 23 | |
| 24 | render = () => ( |
| 25 | <button onClick={this.confirmAndDelete} className={this.className} type="submit"> |
| 26 | Remove |
| 27 | </button> |
| 28 | ) |
| 29 | } |
| 30 | |
| 31 | export default DeleteButton |
nothing calls this directly
no outgoing calls
no test coverage detected