gab-social/app/javascript/gabsocial/components/sidebar_header.js

57 lines
1.5 KiB
JavaScript
Raw Normal View History

2020-02-22 23:26:23 +00:00
import { Fragment } from 'react'
2020-02-08 06:12:01 +00:00
import { NavLink } from 'react-router-dom'
2020-02-05 22:45:48 +00:00
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import { me } from '../initial_state'
import { makeGetAccount } from '../selectors'
2020-03-31 17:04:50 +01:00
import Icon from './icon'
2020-02-22 23:26:23 +00:00
import SidebarSectionItem from './sidebar_section_item'
2020-03-27 23:08:19 +00:00
import Text from './text'
2019-08-15 04:04:03 +01:00
const mapStateToProps = state => {
2020-02-05 22:45:48 +00:00
const getAccount = makeGetAccount()
2019-08-15 04:04:03 +01:00
return {
account: getAccount(state, me),
2020-02-05 22:45:48 +00:00
}
}
2019-08-15 04:04:03 +01:00
2020-02-28 15:20:47 +00:00
export default
@connect(mapStateToProps)
2020-02-22 23:26:23 +00:00
class SidebarHeader extends ImmutablePureComponent {
2019-08-15 04:04:03 +01:00
static propTypes = {
account: ImmutablePropTypes.map,
2020-02-08 06:12:01 +00:00
}
render() {
2020-02-22 23:26:23 +00:00
const { account } = this.props
2020-02-08 06:12:01 +00:00
2020-03-31 17:04:50 +01:00
const isPro = account.get('is_pro')
2020-02-08 06:12:01 +00:00
return (
2020-02-22 23:26:23 +00:00
<Fragment>
<h1 className={[_s.default].join(' ')}>
2020-03-27 23:08:19 +00:00
<NavLink to='/' aria-label='Gab' className={[_s.default, _s.flexRow, _s.noSelect, _s.noUnderline, _s.height50PX, _s.cursorPointer, _s.px10].join(' ')}>
2020-04-07 02:53:23 +01:00
<Icon id='gab-logo' className={_s.fillColorBrand} />
2020-03-31 17:04:50 +01:00
{
isPro &&
2020-04-07 02:53:23 +01:00
<Text weight='bold' color='brand' size='extraSmall' className={[_s.pb5].join(' ')}>
2020-03-31 17:04:50 +01:00
PRO
</Text>
}
2020-02-22 23:26:23 +00:00
</NavLink>
</h1>
{
(!!me && !!account) &&
<SidebarSectionItem
image={account.get('avatar')}
title={account.get('acct')}
to={`/${account.get('acct')}`}
/>
}
</Fragment>
2020-02-08 06:12:01 +00:00
)
}
}