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.
 
 
 
 

30 lines
775 B

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