logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

column_back_button.js (723B)


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