2018-04-07 00:29:51 +02:00
|
|
|
import React, { Component } from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
2018-05-15 13:43:39 +02:00
|
|
|
import Button from '../../button'
|
2018-04-07 00:29:51 +02:00
|
|
|
|
|
|
|
export default class PageContainerFooter extends Component {
|
|
|
|
|
|
|
|
static propTypes = {
|
2018-09-24 05:17:54 +02:00
|
|
|
children: PropTypes.node,
|
2018-04-07 00:29:51 +02:00
|
|
|
onCancel: PropTypes.func,
|
2018-04-11 00:28:52 +02:00
|
|
|
cancelText: PropTypes.string,
|
2018-04-07 00:29:51 +02:00
|
|
|
onSubmit: PropTypes.func,
|
2018-04-11 00:28:52 +02:00
|
|
|
submitText: PropTypes.string,
|
2018-04-07 00:29:51 +02:00
|
|
|
disabled: PropTypes.bool,
|
2018-06-23 08:52:45 +02:00
|
|
|
submitButtonType: PropTypes.string,
|
2018-04-11 00:28:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static contextTypes = {
|
|
|
|
t: PropTypes.func,
|
|
|
|
}
|
2018-04-07 00:29:51 +02:00
|
|
|
|
|
|
|
render () {
|
2018-04-11 00:28:52 +02:00
|
|
|
const {
|
2018-09-24 05:17:54 +02:00
|
|
|
children,
|
2018-04-11 00:28:52 +02:00
|
|
|
onCancel,
|
|
|
|
cancelText,
|
|
|
|
onSubmit,
|
|
|
|
submitText,
|
|
|
|
disabled,
|
2018-06-23 08:52:45 +02:00
|
|
|
submitButtonType,
|
2018-04-11 00:28:52 +02:00
|
|
|
} = this.props
|
2018-04-07 00:29:51 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="page-container__footer">
|
|
|
|
|
2018-10-01 15:04:11 +02:00
|
|
|
<header>
|
2018-09-24 05:17:54 +02:00
|
|
|
<Button
|
|
|
|
type="default"
|
|
|
|
large
|
|
|
|
className="page-container__footer-button"
|
|
|
|
onClick={e => onCancel(e)}
|
|
|
|
>
|
|
|
|
{ cancelText || this.context.t('cancel') }
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
type={submitButtonType || 'primary'}
|
|
|
|
large
|
|
|
|
className="page-container__footer-button"
|
|
|
|
disabled={disabled}
|
|
|
|
onClick={e => onSubmit(e)}
|
|
|
|
>
|
|
|
|
{ submitText || this.context.t('next') }
|
|
|
|
</Button>
|
2018-10-01 15:04:11 +02:00
|
|
|
</header>
|
2018-09-24 05:17:54 +02:00
|
|
|
|
|
|
|
{children && (
|
2018-10-01 15:04:11 +02:00
|
|
|
<footer>
|
2018-09-24 05:17:54 +02:00
|
|
|
{children}
|
2018-10-01 15:04:11 +02:00
|
|
|
</footer>
|
2018-09-24 05:17:54 +02:00
|
|
|
)}
|
2018-04-07 00:29:51 +02:00
|
|
|
|
|
|
|
</div>
|
2018-04-11 00:28:52 +02:00
|
|
|
)
|
2018-04-07 00:29:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|