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