2017-05-02 20:04:16 -04:00
|
|
|
import React from 'react';
|
2017-01-02 19:15:42 -05:00
|
|
|
import { FormattedMessage } from 'react-intl';
|
2017-04-21 14:05:35 -04:00
|
|
|
import PropTypes from 'prop-types';
|
2017-01-02 19:15:42 -05:00
|
|
|
|
2017-04-21 14:05:35 -04:00
|
|
|
class ColumnBackButtonSlim extends React.PureComponent {
|
2017-01-02 19:15:42 -05:00
|
|
|
|
2017-05-12 08:44:10 -04:00
|
|
|
static contextTypes = {
|
2017-05-20 11:31:47 -04:00
|
|
|
router: PropTypes.object,
|
2017-05-12 08:44:10 -04:00
|
|
|
};
|
2017-01-02 19:15:42 -05:00
|
|
|
|
2017-05-12 08:44:10 -04:00
|
|
|
handleClick = () => {
|
2017-06-20 14:40:03 -04:00
|
|
|
if (window.history && window.history.length === 1) this.context.router.history.push('/');
|
|
|
|
else this.context.router.history.goBack();
|
2017-04-21 14:05:35 -04:00
|
|
|
}
|
2017-01-02 19:15:42 -05:00
|
|
|
|
|
|
|
render () {
|
|
|
|
return (
|
2017-04-22 22:26:55 -04:00
|
|
|
<div className='column-back-button--slim'>
|
2017-04-23 08:18:58 -04:00
|
|
|
<div role='button' tabIndex='0' onClick={this.handleClick} className='column-back-button column-back-button--slim-button'>
|
2017-04-22 22:26:55 -04:00
|
|
|
<i className='fa fa-fw fa-chevron-left column-back-button__icon' />
|
2017-01-02 19:15:42 -05:00
|
|
|
<FormattedMessage id='column_back_button.label' defaultMessage='Back' />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-05-20 11:31:47 -04:00
|
|
|
|
2017-04-21 14:05:35 -04:00
|
|
|
}
|
|
|
|
|
2017-01-30 09:22:04 -05:00
|
|
|
export default ColumnBackButtonSlim;
|