2017-11-15 17:35:32 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Controller
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2017-11-15 17:48:30 +01:00
|
|
|
import { get, map } from 'lodash';
|
2017-11-15 17:35:32 +01:00
|
|
|
|
2017-11-15 17:48:30 +01:00
|
|
|
import InputCheckbox from 'components/InputCheckbox';
|
2017-11-15 17:35:32 +01:00
|
|
|
import styles from './styles.scss';
|
|
|
|
|
|
|
|
function Controller({ actions, name }) {
|
|
|
|
return (
|
|
|
|
<div className={styles.controller}>
|
|
|
|
<div className={styles.controllerHeader}>
|
|
|
|
<span>{name}</span>
|
|
|
|
</div>
|
|
|
|
<div className="row">
|
|
|
|
{map(actions, (action, key) => (
|
2017-11-15 17:48:30 +01:00
|
|
|
<InputCheckbox
|
2017-11-15 17:35:32 +01:00
|
|
|
key={key}
|
2017-11-15 17:48:30 +01:00
|
|
|
value={get(action, 'enabled')}
|
2017-11-15 17:35:32 +01:00
|
|
|
/>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Controller.defaultProps = {
|
|
|
|
actions: {},
|
|
|
|
name: '',
|
|
|
|
};
|
|
|
|
|
|
|
|
Controller.propTypes = {
|
|
|
|
actions: PropTypes.object,
|
|
|
|
name: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Controller;
|