diff options
author | Kevyn Bruyere <6eme.hokage@gmail.com> | 2016-06-15 14:30:32 +0200 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-06-15 06:30:32 -0600 |
commit | d6fdd936797890565dff4e6951a6792b7e09831c (patch) | |
tree | ca188cd891cb4930bae303f1d5f92250c75deba3 /webapp/components/status_icon.jsx | |
parent | dbcf8572e5af1c0c244850627437d97616098740 (diff) | |
download | chat-d6fdd936797890565dff4e6951a6792b7e09831c.tar.gz chat-d6fdd936797890565dff4e6951a6792b7e09831c.tar.bz2 chat-d6fdd936797890565dff4e6951a6792b7e09831c.zip |
PLT-946 Add status icon to the left of the username in DM channel (#3258)
Add a StatusIcon component to be able to display a status icon from anywhere
Diffstat (limited to 'webapp/components/status_icon.jsx')
-rw-r--r-- | webapp/components/status_icon.jsx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/webapp/components/status_icon.jsx b/webapp/components/status_icon.jsx new file mode 100644 index 000000000..a4242fb60 --- /dev/null +++ b/webapp/components/status_icon.jsx @@ -0,0 +1,37 @@ +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import Constants from 'utils/constants.jsx'; + +import React from 'react'; + +export default class StatusIcon extends React.Component { + render() { + const status = this.props.status; + + if (!status) { + return null; + } + + let statusIcon = ''; + if (status === 'online') { + statusIcon = Constants.ONLINE_ICON_SVG; + } else if (status === 'away') { + statusIcon = Constants.AWAY_ICON_SVG; + } else { + statusIcon = Constants.OFFLINE_ICON_SVG; + } + + return ( + <span + className='status' + dangerouslySetInnerHTML={{__html: statusIcon}} + /> + ); + } + +} + +StatusIcon.propTypes = { + status: React.PropTypes.string.isRequired +};
\ No newline at end of file |