bigbuffet-rw/app/soapbox/components/timeline_queue_button_header.js

37 lines
846 B
JavaScript
Raw Normal View History

2020-03-27 13:59:38 -07:00
import React from 'react';
import PropTypes from 'prop-types';
import { injectIntl } from 'react-intl';
2020-03-27 13:59:38 -07:00
import classNames from 'classnames';
export default @injectIntl
class TimelineQueueButtonHeader extends React.PureComponent {
2020-04-14 11:44:40 -07:00
2020-03-27 13:59:38 -07:00
static propTypes = {
onClick: PropTypes.func.isRequired,
count: PropTypes.number,
message: PropTypes.object.isRequired,
intl: PropTypes.object.isRequired,
2020-03-27 13:59:38 -07:00
};
static defaultProps = {
count: 0,
};
render() {
const { count, message, onClick, intl } = this.props;
2020-03-27 13:59:38 -07:00
const classes = classNames('timeline-queue-header', {
2020-04-14 11:44:40 -07:00
'hidden': (count <= 0),
2020-03-27 13:59:38 -07:00
});
return (
<div className={classes}>
<a className='timeline-queue-header__btn' onClick={onClick}>
{(count > 0) && intl.formatMessage(message, { count })}
2020-03-27 13:59:38 -07:00
</a>
</div>
);
}
2020-04-14 11:44:40 -07:00
2020-03-27 13:59:38 -07:00
}