Refactoring
This commit is contained in:
@@ -8,6 +8,7 @@ import Box from '../../components/UI/Box/Box';
|
||||
import Text from '../../components/UI/Text/Text';
|
||||
import {notifyError} from '../../redux/actions/error_actions';
|
||||
import {addRemoteMount} from '../../redux/actions/mount_actions';
|
||||
import {createModalConditionally} from '../../utils';
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
@@ -52,11 +53,6 @@ export default connect(mapStateToProps, mapDispatchToProps)(class extends Compon
|
||||
}
|
||||
};
|
||||
|
||||
createModalConditionally = (condition, jsx, critical) => {
|
||||
const modalProps = {critical: critical};
|
||||
return condition ? (<Modal {...modalProps}>{jsx}</Modal>) : null;
|
||||
};
|
||||
|
||||
handleAddRemoteMount = () => {
|
||||
this.setState({
|
||||
Display: true,
|
||||
@@ -64,7 +60,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class extends Compon
|
||||
};
|
||||
|
||||
render() {
|
||||
const displayAdd = this.createModalConditionally(this.state.Display, (
|
||||
const displayAdd = createModalConditionally(this.state.Display, (
|
||||
<Box dxDark
|
||||
dxStyle={{width: 'auto', height: 'auto', padding: '8px'}}>
|
||||
<h1 style={{color: 'var(--text_color_error)', textAlign: 'center', paddingBottom: '8px'}}>Add Remote Mount</h1>
|
||||
|
||||
Reference in New Issue
Block a user