UNPKG

trc-client-core

Version:
43 lines (37 loc) 1.05 kB
var React = require('react'); var ModuleStatus = React.createClass({ displayName: 'ModuleStatus', mixins: [ require('bd-stampy/mixins/ClassMixin') ], propTypes: { status: React.PropTypes.string }, getDefaultProps() { return { status: 'INCOMPLETE' }; }, render: function () { var {status, type} = this.props; var statusTable = { COMPLETED: { color: 'green', text: 'Complete' }, IN_PROGRESS: { color: 'yellow', text: 'In Progress' }, INCOMPLETE: { color: 'muted', text: 'Incomplete' } }; var classes = this.createClassName(type) .modifier(statusTable[status].color) .add(`t-${statusTable[status].color}`); return <span {...this.props} className={classes.className}>{statusTable[status].text}</span>; } }); module.exports = ModuleStatus;