Rocket.Chat.ReactNative/app/containers/Status/Status.js

37 lines
714 B
JavaScript
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
import { View } from 'react-native';
2019-12-17 14:08:06 +00:00
import { STATUS_COLORS, themes } from '../../constants/colors';
2019-12-17 14:08:06 +00:00
const Status = React.memo(({
status, size, style, theme, ...props
2019-12-17 14:08:06 +00:00
}) => (
<View
style={
[
style,
{
borderRadius: size,
width: size,
height: size,
backgroundColor: STATUS_COLORS[status] ?? STATUS_COLORS.offline,
2019-12-17 14:08:06 +00:00
borderColor: themes[theme].backgroundColor
}
]}
{...props}
/>
));
Status.propTypes = {
status: PropTypes.string,
size: PropTypes.number,
2019-12-17 14:08:06 +00:00
style: PropTypes.any,
theme: PropTypes.string
};
Status.defaultProps = {
status: 'offline',
2019-12-17 14:08:06 +00:00
size: 16,
theme: 'light'
};
export default Status;