verdnatura-chat/app/containers/Status/index.js

33 lines
751 B
JavaScript
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import Status from './Status';
2020-01-29 20:20:36 +00:00
import { withTheme } from '../../theme';
class StatusContainer extends React.PureComponent {
static propTypes = {
style: PropTypes.any,
size: PropTypes.number,
2020-01-29 20:20:36 +00:00
status: PropTypes.string,
theme: PropTypes.string
};
static defaultProps = {
size: 16
}
render() {
2020-01-29 20:20:36 +00:00
const {
style, size, status, theme
} = this.props;
return <Status size={size} style={style} status={status} theme={theme} />;
}
}
const mapStateToProps = (state, ownProps) => ({
status: state.meteor.connected ? state.activeUsers[ownProps.id] : 'offline'
});
2020-01-29 20:20:36 +00:00
export default connect(mapStateToProps)(withTheme(StatusContainer));