Clean up logo code

merge-requests/1/head
Alex Gleason 2020-04-10 17:17:02 -05:00
rodzic f351823129
commit 7bbe293537
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 9 dodań i 11 usunięć

Wyświetl plik

@ -9,21 +9,19 @@ const mapStateToProps = (state, props) => ({
});
class LandingPage extends ImmutablePureComponent {
shouldComponentUpdate(nextProps, nextState) {
const { instance, soapbox } = nextProps;
return !instance.isEmpty() && !soapbox.isEmpty();
getSiteLogo = () => {
const { instance, soapbox } = this.props;
const logos = {
imgLogo: (<img alt={instance.get('title')} src={soapbox.get('logo')} />),
textLogo: (<h1>{instance.get('title')}</h1>),
}
return soapbox.get('logo') ? logos['imgLogo'] : logos['textLogo'];
}
render() {
const { instance, soapbox } = this.props;
if (instance.isEmpty() || soapbox.isEmpty()) return null;
const siteLogo = soapbox.get('logo') ? (
<img alt={instance.get('title')} src={soapbox.get('logo')} />
) : (
<h1>{instance.get('title')}</h1>
);
if (instance.isEmpty()) return null;
const siteLogo = this.getSiteLogo();
return (
<div className='public-layout'>