Add text prop to DeleteConfirmButtons for configurable text copy

pull/10616/head
Jared Scheib 2017-11-10 01:50:18 -08:00
parent 8b2282993f
commit 48565343b7
1 changed files with 10 additions and 3 deletions

View File

@ -4,14 +4,14 @@ import classnames from 'classnames'
import OnClickOutside from 'shared/components/OnClickOutside'
import ConfirmButtons from 'shared/components/ConfirmButtons'
const DeleteButton = ({onClickDelete, buttonSize}) =>
const DeleteButton = ({onClickDelete, buttonSize, text}) =>
<button
className={classnames('btn btn-danger table--show-on-row-hover', {
[buttonSize]: buttonSize,
})}
onClick={onClickDelete}
>
Delete
{text}
</button>
class DeleteConfirmButtons extends Component {
@ -37,7 +37,7 @@ class DeleteConfirmButtons extends Component {
}
render() {
const {onDelete, item, buttonSize} = this.props
const {onDelete, item, buttonSize, text} = this.props
const {isConfirming} = this.state
return isConfirming
@ -48,6 +48,7 @@ class DeleteConfirmButtons extends Component {
buttonSize={buttonSize}
/>
: <DeleteButton
text={text}
onClickDelete={this.handleClickDelete}
buttonSize={buttonSize}
/>
@ -57,11 +58,17 @@ class DeleteConfirmButtons extends Component {
const {func, oneOfType, shape, string} = PropTypes
DeleteButton.propTypes = {
text: string.isRequired,
onClickDelete: func.isRequired,
buttonSize: string,
}
DeleteButton.defaultProps = {
text: 'Delete',
}
DeleteConfirmButtons.propTypes = {
text: string,
item: oneOfType([(string, shape())]),
onDelete: func.isRequired,
buttonSize: string,