Updated NavigationBarButton style to be icon top, title bottom

• Updated:
- NavigationBarButton style to be icon top, title bottom
This commit is contained in:
mgabdev 2020-10-28 23:15:37 -05:00
parent 8a20e4ee0a
commit 1a118a50b0

View File

@ -14,15 +14,15 @@ class NavigationBarButton extends React.PureComponent {
to, to,
href, href,
attrTitle, attrTitle,
count,
onClick, onClick,
} = this.props } = this.props
const active = false const active = to == window.location.pathname
const classes = CX({ const classes = CX({
d: 1, d: 1,
h53PX: 1, h53PX: 1,
flexRow: 1,
aiCenter: 1, aiCenter: 1,
jcCenter: 1, jcCenter: 1,
outlineNone: 1, outlineNone: 1,
@ -30,20 +30,37 @@ class NavigationBarButton extends React.PureComponent {
bgTransparent: 1, bgTransparent: 1,
noUnderline: 1, noUnderline: 1,
colorNavigation: 1, colorNavigation: 1,
px10: !!title, px15: !!title,
px5: !title, px5: !title,
py2: !title,
cWhite: !!title, cWhite: !!title,
fs13PX: !!title, fs13PX: !!title,
fw400: !!title, fw400: !!title,
navigationUnderlineActive: !!title && active,
}) })
const iconClasses = CX({ const iconClasses = CX({
fillNavigation: !!title || active, fillNavigation: !!title || active,
fillNavigationBlend: !title, fillNavigationBlend: !title,
mr10: !!title, px2: !title,
}) })
const iconSize = !!title ? '16px' : '18px' const countClasses = CX({
d: 1,
fs12PX: 1,
posAbs: 1,
top0: 1,
mt15: 1,
right0: 1,
mr5: 1,
h4PX: 1,
w4PX: 1,
cBrand: 1,
bgNavigationBlend: 1,
radiusSmall: 1,
})
const iconSize = !!title ? '18px' : '20px'
return ( return (
<Button <Button
@ -53,14 +70,18 @@ class NavigationBarButton extends React.PureComponent {
onClick={onClick} onClick={onClick}
className={classes} className={classes}
noClasses noClasses
> >
<Icon className={iconClasses} id={icon} size={iconSize} /> <Icon className={iconClasses} id={icon} size={iconSize} />
{ {
!!title && !!title &&
<Text color='white'> <Text color='white' size='extraSmall' className={_s.mt5}>
{title} {title}
</Text> </Text>
} }
{
!title && count > 0 &&
<span className={countClasses} />
}
</Button> </Button>
) )
} }
@ -73,6 +94,7 @@ NavigationBarButton.propTypes = {
to: PropTypes.string, to: PropTypes.string,
href: PropTypes.string, href: PropTypes.string,
attrTitle: PropTypes.string, attrTitle: PropTypes.string,
count: PropTypes.number,
onClick: PropTypes.func, onClick: PropTypes.func,
} }