2020-02-24 21:56:07 +00:00
|
|
|
import Icon from './icon'
|
|
|
|
import Button from './button'
|
2020-01-27 22:20:07 +00:00
|
|
|
|
2020-04-08 02:06:59 +01:00
|
|
|
export default class FloatingActionButton extends PureComponent {
|
2019-08-07 06:02:36 +01:00
|
|
|
static propTypes = {
|
|
|
|
onClick: PropTypes.func.isRequired,
|
|
|
|
message: PropTypes.string.isRequired,
|
|
|
|
};
|
|
|
|
|
2020-01-27 22:20:07 +00:00
|
|
|
shouldComponentUpdate(nextProps) {
|
|
|
|
return nextProps.message !== this.props.message;
|
2019-08-07 06:02:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { onClick, message } = this.props;
|
|
|
|
|
2020-03-26 03:11:32 +00:00
|
|
|
// const shouldHideFAB = path => path.match(/^\/posts\/|^\/search|^\/getting-started/);
|
|
|
|
// const floatingActionButton = shouldHideFAB(this.context.router.history.location.pathname) ? null : <button key='floating-action-button' onClick={this.handleOpenComposeModal} className='floating-action-button' aria-label={intl.formatMessage(messages.publish)}></button>;
|
|
|
|
|
2019-08-07 06:02:36 +01:00
|
|
|
return (
|
2020-03-26 03:11:32 +00:00
|
|
|
<Button
|
|
|
|
onClick={onClick}
|
|
|
|
color='white'
|
|
|
|
className={[_s.positionFixed, _s.z4, _s.bottom0, _s.right0].join(' ')}
|
|
|
|
title={message}
|
|
|
|
aria-label={message}
|
|
|
|
>
|
2020-02-24 21:56:07 +00:00
|
|
|
<Icon id='compose' />
|
2020-03-26 03:11:32 +00:00
|
|
|
[...]
|
2020-02-24 21:56:07 +00:00
|
|
|
</Button>
|
2019-08-07 06:02:36 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|