2020-08-17 21:07:16 +01:00
|
|
|
import React from 'react'
|
2020-08-17 21:59:29 +01:00
|
|
|
import PropTypes from 'prop-types'
|
2020-07-25 00:51:14 +01:00
|
|
|
import { CX } from '../constants'
|
|
|
|
import Button from './button'
|
|
|
|
import Icon from './icon'
|
|
|
|
import Text from './text'
|
|
|
|
|
2020-08-18 01:57:35 +01:00
|
|
|
class NavigationBarButton extends React.PureComponent {
|
2020-07-25 00:51:14 +01:00
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
title,
|
|
|
|
icon,
|
|
|
|
to,
|
|
|
|
href,
|
|
|
|
attrTitle,
|
2020-10-16 23:00:33 +01:00
|
|
|
onClick,
|
2020-07-25 00:51:14 +01:00
|
|
|
} = this.props
|
|
|
|
|
|
|
|
const active = false
|
|
|
|
|
|
|
|
const classes = CX({
|
2020-08-18 21:49:11 +01:00
|
|
|
d: 1,
|
2020-08-18 21:43:06 +01:00
|
|
|
h53PX: 1,
|
2020-07-25 00:51:14 +01:00
|
|
|
flexRow: 1,
|
2020-08-18 21:43:06 +01:00
|
|
|
aiCenter: 1,
|
|
|
|
jcCenter: 1,
|
2020-07-25 00:51:14 +01:00
|
|
|
outlineNone: 1,
|
|
|
|
cursorPointer: 1,
|
|
|
|
bgTransparent: 1,
|
|
|
|
noUnderline: 1,
|
|
|
|
colorNavigation: 1,
|
|
|
|
px10: !!title,
|
|
|
|
px5: !title,
|
2020-08-18 21:43:06 +01:00
|
|
|
cWhite: !!title,
|
2020-07-25 00:51:14 +01:00
|
|
|
fs13PX: !!title,
|
2020-08-18 21:43:06 +01:00
|
|
|
fw400: !!title,
|
2020-07-25 00:51:14 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
const iconClasses = CX({
|
|
|
|
fillNavigation: !!title || active,
|
|
|
|
fillNavigationBlend: !title,
|
|
|
|
mr10: !!title,
|
|
|
|
})
|
|
|
|
|
|
|
|
const iconSize = !!title ? '16px' : '18px'
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Button
|
|
|
|
to={to}
|
|
|
|
href={href}
|
|
|
|
title={attrTitle}
|
2020-10-16 23:00:33 +01:00
|
|
|
onClick={onClick}
|
2020-07-25 00:51:14 +01:00
|
|
|
className={classes}
|
|
|
|
noClasses
|
|
|
|
>
|
|
|
|
<Icon className={iconClasses} id={icon} size={iconSize} />
|
|
|
|
{
|
|
|
|
!!title &&
|
|
|
|
<Text color='white'>
|
|
|
|
{title}
|
|
|
|
</Text>
|
|
|
|
}
|
|
|
|
</Button>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-08-18 01:57:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
NavigationBarButton.propTypes = {
|
|
|
|
title: PropTypes.string,
|
|
|
|
icon: PropTypes.string,
|
|
|
|
to: PropTypes.string,
|
|
|
|
href: PropTypes.string,
|
|
|
|
attrTitle: PropTypes.string,
|
2020-10-16 23:00:33 +01:00
|
|
|
onClick: PropTypes.func,
|
2020-08-18 01:57:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export default NavigationBarButton
|