MCPcopy Create free account
hub / github.com/emwalker/digraph / DeleteButton

Class DeleteButton

client/src/components/ui/DeleteButton/index.tsx:9–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7}
8
9class 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
31export default DeleteButton

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected