From 45c44989c8fb6e24badd18bb83ac5f68de0aceaf Mon Sep 17 00:00:00 2001 From: kibigo! Date: Fri, 17 Nov 2017 19:11:18 -0800 Subject: Forking glitch theme --- .../glitch/components/column_back_button_slim.js | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 app/javascript/themes/glitch/components/column_back_button_slim.js (limited to 'app/javascript/themes/glitch/components/column_back_button_slim.js') diff --git a/app/javascript/themes/glitch/components/column_back_button_slim.js b/app/javascript/themes/glitch/components/column_back_button_slim.js new file mode 100644 index 000000000..2cdf1b25b --- /dev/null +++ b/app/javascript/themes/glitch/components/column_back_button_slim.js @@ -0,0 +1,31 @@ +import React from 'react'; +import { FormattedMessage } from 'react-intl'; +import PropTypes from 'prop-types'; + +export default class ColumnBackButtonSlim extends React.PureComponent { + + static contextTypes = { + router: PropTypes.object, + }; + + handleClick = () => { + // if history is exhausted, or we would leave mastodon, just go to root. + if (window.history && (window.history.length === 1 || window.history.length === window._mastoInitialHistoryLen)) { + this.context.router.history.push('/'); + } else { + this.context.router.history.goBack(); + } + } + + render () { + return ( +
+
+ + +
+
+ ); + } + +} -- cgit