import React from 'react'; import { connect } from 'react-redux'; import classNames from 'classnames'; class Plugins extends React.Component { renderPlugin({id, label, description, status}) { const error = status !== 'ok'; const className = classNames({ error }); const title = `Status: ${status} | Plugin description: ${description}`; // Inner span to hold styling so we don't effect the "before:content" return ( {error && } {label || id} ); } render() { const hasPlugins = this.props.plugins && this.props.plugins.size > 0; return (
Plugins: {hasPlugins && this.props.plugins.toIndexedSeq() .map(plugin => this.renderPlugin(plugin.toJS()))} {!hasPlugins && n/a}
); } } function mapStateToProps(state) { return { plugins: state.get('plugins') }; } export default connect( mapStateToProps )(Plugins);