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

28 lines
667 B
JavaScript
Raw Normal View History

2020-02-24 16:56:07 -05:00
import Button from './button'
2020-01-27 17:20:07 -05:00
2020-04-07 21:06:59 -04:00
export default class FloatingActionButton extends PureComponent {
static propTypes = {
onClick: PropTypes.func.isRequired,
message: PropTypes.string.isRequired,
2020-04-11 18:29:19 -04:00
}
2020-01-27 17:20:07 -05:00
shouldComponentUpdate(nextProps) {
2020-04-11 18:29:19 -04:00
return nextProps.message !== this.props.message
}
render() {
2020-04-11 18:29:19 -04:00
const { onClick, message } = this.props
2020-03-25 23:11:32 -04:00
return (
2020-03-25 23:11:32 -04:00
<Button
onClick={onClick}
color='white'
2020-04-09 15:18:14 -04:00
backgroundColor='brand'
className={[_s.positionFixed, _s.z4, _s.py15, _s.mb15, _s.mr15, _s.bottom0, _s.right0].join(' ')}
2020-03-25 23:11:32 -04:00
title={message}
aria-label={message}
2020-04-09 15:18:14 -04:00
icon='pencil'
/>
)
}
}