Handle the good, warning, danger status for post attachments (#1425)
This commit is contained in:
parent
39181bd7b9
commit
bd3a5e1288
1 changed files with 12 additions and 2 deletions
|
|
@ -17,6 +17,12 @@ import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
|
|||
|
||||
import InteractiveAction from './interactive_action';
|
||||
|
||||
const STATUS_COLORS = {
|
||||
good: '#00c100',
|
||||
warning: '#dede01',
|
||||
danger: '#e40303'
|
||||
};
|
||||
|
||||
export default class SlackAttachment extends PureComponent {
|
||||
static propTypes = {
|
||||
attachment: PropTypes.object.isRequired,
|
||||
|
|
@ -228,8 +234,12 @@ export default class SlackAttachment extends PureComponent {
|
|||
}
|
||||
|
||||
let borderStyle;
|
||||
if (attachment.color && attachment.color[0] === '#') {
|
||||
borderStyle = {borderLeftColor: attachment.color};
|
||||
if (attachment.color) {
|
||||
if (attachment.color[0] === '#') {
|
||||
borderStyle = {borderLeftColor: attachment.color};
|
||||
} else if (STATUS_COLORS.hasOwnProperty(attachment.color)) {
|
||||
borderStyle = {borderLeftColor: STATUS_COLORS[attachment.color]};
|
||||
}
|
||||
}
|
||||
|
||||
const author = [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue