LandingPage: Conditionally show "Back to {site_title}" instead of login form, fixes #135
This commit is contained in:
@ -1,12 +1,28 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import { Link } from 'react-router-dom';
|
||||
import LoginForm from 'soapbox/features/auth_login/components/login_form';
|
||||
import SiteLogo from './site_logo';
|
||||
import SoapboxPropTypes from 'soapbox/utils/soapbox_prop_types';
|
||||
|
||||
export default class Header extends ImmutablePureComponent {
|
||||
const mapStateToProps = state => ({
|
||||
me: state.get('me'),
|
||||
instance: state.get('instance'),
|
||||
});
|
||||
|
||||
export default @connect(mapStateToProps)
|
||||
class Header extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
me: SoapboxPropTypes.me,
|
||||
instance: ImmutablePropTypes.map,
|
||||
}
|
||||
|
||||
render() {
|
||||
const { me, instance } = this.props;
|
||||
|
||||
return (
|
||||
<nav className='header'>
|
||||
<div className='header-container'>
|
||||
@ -20,10 +36,13 @@ export default class Header extends ImmutablePureComponent {
|
||||
<div className='nav-center' />
|
||||
<div className='nav-right'>
|
||||
<div className='hidden-sm'>
|
||||
<LoginForm />
|
||||
{me
|
||||
? <Link className='nav-link nav-button webapp-btn' to='/'>Back to {instance.get('title')}</Link>
|
||||
: <LoginForm />
|
||||
}
|
||||
</div>
|
||||
<div className='visible-sm'>
|
||||
<Link className='webapp-btn nav-link nav-button' to='/auth/sign_in'>Log in</Link>
|
||||
<Link className='nav-link nav-button webapp-btn' to='/auth/sign_in'>Log in</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user