闭社主体 forked from https://github.com/tootsuite/mastodon
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.

29 lines
833 B

  1. import React from 'react';
  2. import { FormattedMessage } from 'react-intl';
  3. import PropTypes from 'prop-types';
  4. class ColumnBackButtonSlim extends React.PureComponent {
  5. static contextTypes = {
  6. router: PropTypes.object,
  7. };
  8. handleClick = () => {
  9. if (window.history && window.history.length === 1) this.context.router.push('/');
  10. else this.context.router.goBack();
  11. }
  12. render () {
  13. return (
  14. <div className='column-back-button--slim'>
  15. <div role='button' tabIndex='0' onClick={this.handleClick} className='column-back-button column-back-button--slim-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. </div>
  20. );
  21. }
  22. }
  23. export default ColumnBackButtonSlim;