-
Notifications
You must be signed in to change notification settings - Fork 51
/
DeleteEntry.js
61 lines (58 loc) · 1.75 KB
/
DeleteEntry.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import {
Button,
Popover,
Overlay
} from 'react-bootstrap'
import ReactDOM from 'react-dom'
import { Icon } from '../../components'
class DeleteEntry extends Component {
static propTypes = {
locale: PropTypes.object,
show: PropTypes.bool,
handleDeleteEntryDisplay: PropTypes.func.isRequired,
handleDeleteEntry: PropTypes.func.isRequired
}
render () {
const {
locale,
show,
handleDeleteEntryDisplay,
handleDeleteEntry
} = this.props
/* eslint-disable react/jsx-no-bind */
return (
<div className='u-blockInline'>
<Button bsSize='small'
onClick={() => handleDeleteEntryDisplay(true)}>
<Icon name='cross' className='n2 iconCross' title='cross' />
Delete
</Button>
<Overlay show={show} placement='top'
target={() => ReactDOM.findDOMNode(this)}>
<Popover id='popover-contained' title='Delete language'>
<p>Are you sure you want to delete
<strong>{locale.displayName}</strong>?
</p>
<span className='button-spacing'>
<Button bsStyle='default' bsSize='small'
onClick={() => handleDeleteEntryDisplay(false)}>
Cancel
</Button>
<Button bsStyle='danger' bsSize='small' type='button'
onClick={() => {
handleDeleteEntry(locale.localeId)
handleDeleteEntryDisplay(false)
}}>
Delete
</Button>
</span>
</Popover>
</Overlay>
</div>
)
/* eslint-enable react/jsx-no-bind */
}
}
export default DeleteEntry