mirror of
https://github.com/flarum/framework.git
synced 2025-05-31 12:35:48 +08:00
Add label to back button, change behaviour
The back button longer shows if the user hasn't actually navigated anywhere. e.g. if they come in directly to a discussion, it will be hidden.
This commit is contained in:
@ -47,11 +47,13 @@ export default class Navigation extends Component {
|
||||
*/
|
||||
getBackButton() {
|
||||
const {history} = app;
|
||||
const previous = history.getPrevious() || {};
|
||||
|
||||
return LinkButton.component({
|
||||
className: 'Button Button--icon Navigation-back',
|
||||
className: 'Button Navigation-back ' + (previous.title ? '' : 'Button--icon'),
|
||||
href: history.backUrl(),
|
||||
icon: 'chevron-left',
|
||||
children: previous.title,
|
||||
config: () => {},
|
||||
onclick: e => {
|
||||
if (e.shiftKey || e.ctrlKey || e.metaKey || e.which === 2) return;
|
||||
|
Reference in New Issue
Block a user