bigbuffet-rw/app/soapbox/features/public_layout/components/site_logo.js

24 lines
650 B
JavaScript
Raw Normal View History

2020-04-25 15:26:47 -07:00
import React from 'react';
import { connect } from 'react-redux';
import ImmutablePureComponent from 'react-immutable-pure-component';
const mapStateToProps = (state, props) => ({
instance: state.get('instance'),
soapbox: state.get('soapbox'),
});
class SiteLogo extends ImmutablePureComponent {
render() {
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.getIn(['logo']) ? logos.imgLogo : logos.textLogo;
2020-04-25 15:26:47 -07:00
}
}
export default connect(mapStateToProps)(SiteLogo);