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.
49 lines
1.2 KiB
49 lines
1.2 KiB
import React from 'react'; |
|
import Logo from 'mastodon/components/logo'; |
|
import { Link, withRouter } from 'react-router-dom'; |
|
import { FormattedMessage } from 'react-intl'; |
|
import { registrationsOpen } from 'mastodon/initial_state'; |
|
import PropTypes from 'prop-types'; |
|
|
|
export default @withRouter |
|
class Header extends React.PureComponent { |
|
|
|
static contextTypes = { |
|
identity: PropTypes.object, |
|
}; |
|
|
|
static propTypes = { |
|
location: PropTypes.object, |
|
}; |
|
|
|
render () { |
|
const { signedIn } = this.context.identity; |
|
|
|
let content; |
|
|
|
if (signedIn) { |
|
content = ( |
|
<> |
|
</> |
|
); |
|
} else { |
|
content = ( |
|
<> |
|
<a href='/auth/sign_in' className='button'><FormattedMessage id='sign_in_banner.sign_in' defaultMessage='Sign in' /></a> |
|
<a href={registrationsOpen ? '/auth/sign_up' : 'https://joinmastodon.org/servers'} className='button button-tertiary'><FormattedMessage id='sign_in_banner.create_account' defaultMessage='Create account' /></a> |
|
</> |
|
); |
|
} |
|
|
|
return ( |
|
<div className='ui__header'> |
|
<Link to='/' className='ui__header__logo'><Logo /></Link> |
|
|
|
<div className='ui__header__links'> |
|
{content} |
|
</div> |
|
</div> |
|
); |
|
} |
|
|
|
}
|
|
|