The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

33 lines
838 B

  1. import React from 'react';
  2. import { FormattedMessage } from 'react-intl';
  3. import PropTypes from 'prop-types';
  4. class ColumnBackButton extends React.PureComponent {
  5. constructor (props, context) {
  6. super(props, context);
  7. this.handleClick = this.handleClick.bind(this);
  8. }
  9. handleClick () {
  10. if (window.history && window.history.length === 1) this.context.router.push("/");
  11. else this.context.router.goBack();
  12. }
  13. render () {
  14. return (
  15. <div role='button' tabIndex='0' onClick={this.handleClick} className='column-back-button'>
  16. <i className='fa fa-fw fa-chevron-left column-back-button__icon'/>
  17. <FormattedMessage id='column_back_button.label' defaultMessage='Back' />
  18. </div>
  19. );
  20. }
  21. };
  22. ColumnBackButton.contextTypes = {
  23. router: PropTypes.object
  24. };
  25. export default ColumnBackButton;