48 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-02-22 18:26:23 -05:00
import { Fragment } from 'react'
2020-02-08 01:12:01 -05:00
import { NavLink } from 'react-router-dom'
2020-02-05 17:45:48 -05:00
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import { me } from '../initial_state'
import { makeGetAccount } from '../selectors'
2020-02-25 11:04:44 -05:00
import GabLogo from '../assets/gab_logo'
2020-02-22 18:26:23 -05:00
import SidebarSectionItem from './sidebar_section_item'
2019-08-14 23:04:03 -04:00
const mapStateToProps = state => {
2020-02-05 17:45:48 -05:00
const getAccount = makeGetAccount()
2019-08-14 23:04:03 -04:00
return {
account: getAccount(state, me),
2020-02-05 17:45:48 -05:00
}
}
2019-08-14 23:04:03 -04:00
2020-02-28 10:20:47 -05:00
export default
@connect(mapStateToProps)
2020-02-22 18:26:23 -05:00
class SidebarHeader extends ImmutablePureComponent {
2019-08-14 23:04:03 -04:00
static propTypes = {
account: ImmutablePropTypes.map,
2020-02-08 01:12:01 -05:00
}
render() {
2020-02-22 18:26:23 -05:00
const { account } = this.props
2020-02-08 01:12:01 -05:00
return (
2020-02-22 18:26:23 -05:00
<Fragment>
<h1 className={[_s.default].join(' ')}>
2020-03-11 19:56:18 -04:00
<NavLink to='/' aria-label='Gab' className={[_s.default, _s.noSelect, _s.noUnderline, _s.height50PX, _s.justifyContentCenter, _s.cursorPointer, _s.px10].join(' ')}>
2020-02-22 18:26:23 -05:00
<GabLogo />
</NavLink>
</h1>
{
(!!me && !!account) &&
<SidebarSectionItem
image={account.get('avatar')}
title={account.get('acct')}
to={`/${account.get('acct')}`}
/>
}
</Fragment>
2020-02-08 01:12:01 -05:00
)
}
}