Added SidebarXS in FooterBar and open SidebarXS from right

• Added:
- SidebarXS in FooterBar
- open SidebarXS from right
This commit is contained in:
mgabdev 2020-10-30 13:05:30 -05:00
parent 73e1584d43
commit ec3310d6df
3 changed files with 44 additions and 13 deletions

@ -1,12 +1,16 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom' import { withRouter } from 'react-router-dom'
import { me } from '../initial_state' import { me } from '../initial_state'
import { openSidebar } from '../actions/sidebar'
import { CX } from '../constants' import { CX } from '../constants'
import Button from './button' import Button from './button'
import Avatar from './avatar'
class FooterBar extends React.PureComponent { class FooterBar extends ImmutablePureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object, router: PropTypes.object,
@ -14,8 +18,10 @@ class FooterBar extends React.PureComponent {
render() { render() {
const { const {
account,
notificationCount, notificationCount,
homeItemsQueueCount, homeItemsQueueCount,
onOpenSidebar,
} = this.props } = this.props
const noRouter = !this.context.router const noRouter = !this.context.router
@ -33,26 +39,26 @@ class FooterBar extends React.PureComponent {
icon: 'notifications', icon: 'notifications',
title: 'Notifications', title: 'Notifications',
isHidden: !me, isHidden: !me,
active: currentPathname === '/notifications', active: currentPathname.indexOf('/notifications') > -1,
}, },
{ {
to: '/groups', to: '/groups',
icon: 'group', icon: 'group',
title: 'Groups', title: 'Groups',
active: currentPathname === '/groups', active: currentPathname.indexOf('/groups') > -1,
},
{
to: '/explore',
icon: 'explore',
title: 'Explore',
isHidden: !me,
active: currentPathname === '/explore',
}, },
{ {
to: '/news', to: '/news',
icon: 'news', icon: 'news',
title: 'News', title: 'News',
active: currentPathname === '/news', isHidden: !!me,
active: currentPathname.indexOf('/news') > -1,
},
{
title: 'Menu',
isHidden: !me,
active: currentPathname === `/${account.get('username')}`,
onClick: onOpenSidebar,
}, },
] ]
@ -94,6 +100,17 @@ class FooterBar extends React.PureComponent {
</span> </span>
</div> </div>
) )
} else if (props.title === 'Menu') {
const avatarContainerClasses = CX({
d: 1,
circle: 1,
boxShadowProfileAvatarFooter: !!props.active,
})
childIcon = (
<div className={avatarContainerClasses}>
<Avatar account={account} size={24} />
</div>
)
} }
return ( return (
@ -103,6 +120,7 @@ class FooterBar extends React.PureComponent {
iconSize='20px' iconSize='20px'
color={color} color={color}
to={props.to} to={props.to}
onClick={props.onClick}
icon={props.icon} icon={props.icon}
href={props.href} href={props.href}
title={props.title} title={props.title}
@ -121,14 +139,23 @@ class FooterBar extends React.PureComponent {
} }
const mapDispatchToProps = (dispatch) => ({
onOpenSidebar() {
dispatch(openSidebar())
},
})
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
account: !!me ? state.getIn(['accounts', me]) : undefined,
notificationCount: !!me ? state.getIn(['notifications', 'unread']) : 0, notificationCount: !!me ? state.getIn(['notifications', 'unread']) : 0,
homeItemsQueueCount: !!me ? state.getIn(['timelines', 'home', 'totalQueuedItemsCount']) : 0, homeItemsQueueCount: !!me ? state.getIn(['timelines', 'home', 'totalQueuedItemsCount']) : 0,
}) })
FooterBar.propTypes = { FooterBar.propTypes = {
account: ImmutablePropTypes.map,
onOpenSidebar: PropTypes.func.isRequired,
notificationCount: PropTypes.number.isRequired, notificationCount: PropTypes.number.isRequired,
homeItemsQueueCount: PropTypes.number.isRequired, homeItemsQueueCount: PropTypes.number.isRequired,
} }
export default withRouter(connect(mapStateToProps)(FooterBar)) export default withRouter(connect(mapStateToProps, mapDispatchToProps)(FooterBar))

@ -62,7 +62,7 @@ class SidebarXS extends ImmutablePureComponent {
return ( return (
<div className={containerClasses}> <div className={containerClasses}>
<div className={[_s.d, _s.posFixed, _s.top0, _s.left0, _s.right0, _s.bgBlackOpaque, _s.bottom0].join(' ')} role='button' onClick={this.handleSidebarClose} /> <div className={[_s.d, _s.posFixed, _s.top0, _s.left0, _s.right0, _s.bgBlackOpaque, _s.bottom0].join(' ')} role='button' onClick={this.handleSidebarClose} />
<div className={[_s.defaut, _s.posFixed, _s.left0, _s.top0, _s.bottom0, _s.bgSecondary, _s.saveAreaInsetPT, _s.saveAreaInsetPB, _s.saveAreaInsetPL, _s.minW330PX, _s.borderRight1PX, _s.borderColorSecondary, _s.maxW80PC, _s.overflowYScroll].join(' ')}> <div className={[_s.defaut, _s.posFixed, _s.right0, _s.top0, _s.bottom0, _s.bgSecondary, _s.saveAreaInsetPT, _s.saveAreaInsetPB, _s.saveAreaInsetPL, _s.minW330PX, _s.borderRight1PX, _s.borderColorSecondary, _s.maxW80PC, _s.overflowYScroll].join(' ')}>
<div <div
className={[_s.d, _s.h122PX].join(' ')} className={[_s.d, _s.h122PX].join(' ')}

@ -871,6 +871,10 @@ pre {
box-shadow: 0 0 0 6px var(--solid_color_primary); box-shadow: 0 0 0 6px var(--solid_color_primary);
} }
.boxShadowProfileAvatarFooter {
box-shadow: 0 0 0 4px var(--solid_color_primary), 0 0 0 5px var(--border_color_secondary);
}
.listStyleNone { .listStyleNone {
list-style: none; list-style: none;
} }