@@ -8,22 +8,30 @@ import NetPyNEField from '../../general/NetPyNEField';
88
99import IconButton from '@material-ui/core/IconButton' ;
1010import Icon from '@material-ui/core/Icon' ;
11-
12- const styles = {
13- card : {
14- main : { padding : 10 , float : 'left' , width : '100%' } ,
15- title : { paddingBottom : 0 } ,
16- cancel : { marginRight : 16 }
11+ import { withStyles } from '@material-ui/core/styles' ;
12+
13+ const styles = ( { spacing, typography, zIndex } ) => ( {
14+ container : {
15+ marginTop : spacing ( 2 ) ,
16+ display : 'flex' ,
17+ flexDirection : 'row' ,
18+ alignItems : 'flex-end' ,
19+ width : '100%'
1720 } ,
18- mods : {
19- container : { width : '100%' , float : 'left' , marginTop : '15px' } ,
20- leftSubContainer : { float : 'left' , width : '50%' } ,
21- rightSubContainer : { float : 'right' , width : '50%' } ,
22- checkbox : { width : '90%' }
23- }
24- }
21+ icon : {
22+ '&:hover' : { backgroundColor : 'inherit' } ,
23+ flex : '0 0 4%' ,
24+ marginRight : spacing ( 2 ) ,
25+ width : typography . h3 . fontSize ,
26+ height : typography . h3 . fontSize ,
27+ padding : '0px!important' ,
28+ zIndex : zIndex . modal
29+ } ,
30+ textField : { alignItems : 'center' } ,
31+ root :{ overflow : 'hidden' } ,
32+ } )
2533
26- export default class ImportCellParams extends React . Component {
34+ class ImportCellParams extends React . Component {
2735
2836 constructor ( props ) {
2937 super ( props ) ;
@@ -65,6 +73,7 @@ export default class ImportCellParams extends React.Component {
6573 }
6674
6775 render ( ) {
76+ const { classes } = this . props
6877 const cellArgs = this . refs . cellArgs ? this . refs . cellArgs . state . children : { }
6978 const { label, fileName, cellName, modFolder, importSynMechs, compileMod, explorerDialogOpen, exploreOnlyDirs } = this . state ;
7079
@@ -77,95 +86,90 @@ export default class ImportCellParams extends React.Component {
7786 args = { { cellArgs, fileName, cellName, label, modFolder, importSynMechs, compileMod } }
7887 { ...this . props }
7988 >
80- < TextField
81- value = { label }
82- id = "importCellTemplateName"
83- label = "Cell rule label"
84- onChange = { event => this . setState ( { label : event . target . value } ) }
85- />
86-
87- < NetPyNEField id = "netParams.importCellParams.cellName" className = "netpyneFieldNoWidth" >
89+ < div className = { classes . root } >
8890 < TextField
89- value = { cellName }
90- id = "importCellTemplateCellName"
91- onChange = { event => this . setState ( { cellName : event . target . value } ) }
91+ value = { label }
92+ className = "netpyneField"
93+ id = "importCellTemplateName"
94+ label = "Cell rule label"
95+ onChange = { event => this . setState ( { label : event . target . value } ) }
9296 />
93- </ NetPyNEField >
94-
95- < div className = "flex-row" >
96- < IconButton
97- id = "importCellTemplateFile"
98- className = 'flex-row-icon b-4'
99- onClick = { ( ) => this . showExplorerDialog ( 'fileName' , false ) }
100- tooltip-data = 'File explorer'
101- >
102- < Icon className = 'fa fa-folder-o listIcon' />
103- </ IconButton >
104-
105- < NetPyNEField id = "netParams.importCellParams.fileName" className = "netpyneFieldNoWidth" >
106- < TextField
107- className = "netpyneFieldNoWidth fx-11 no-z-index"
108- value = { fileName }
109- onChange = { event => this . setState ( { fileName : event . target . value } ) }
110- />
111- </ NetPyNEField >
112-
113- </ div >
114-
11597
116- < div className = "flex-row" >
117- < IconButton
118- id = "importCellTemplateModFile"
119- className = 'flex-row-icon b-4'
120- onClick = { ( ) => this . showExplorerDialog ( 'modFolder' , true ) }
121- tooltip-data = 'File explorer'
122- >
123- < Icon className = "fa fa-folder-o listIcon" />
124- </ IconButton >
125-
126- < NetPyNEField id = "netParams.importCellParams.modFolder" className = "netpyneRightField" >
127- < TextField
128- value = { modFolder }
129- className = "netpyneFieldNoWidth fx-11 no-z-index"
130- onChange = { event => this . setState ( { modFolder : event . target . value } ) }
98+ < NetPyNEField id = "netParams.importCellParams.cellName" className = { classes . textField } >
99+ < TextField
100+ value = { cellName }
101+ id = "importCellTemplateCellName"
102+ onChange = { event => this . setState ( { cellName : event . target . value } ) }
131103 />
132104 </ NetPyNEField >
133- </ div >
134-
135- < div className = "listStyle netpyneField" >
136- < ListComponent id = "cellArgs" realType = "dict" floatingLabelText = "Cell Template Parameters (key:value pair)" ref = "cellArgs" />
137- </ div >
138105
139- < div style = { styles . mods . container } >
140- < div style = { styles . mods . leftSubContainer } >
141- < NetPyNEField id = "netParams.importCellParams.importSynMechs" className = "netpyneCheckbox netpyneFieldNoWidth" noStyle >
142- < Checkbox
143- checked = { importSynMechs }
144- style = { styles . mods . checkbox }
145- onChange = { ( ) => this . updateCheck ( 'importSynMechs' ) }
106+ < div className = { classes . container } >
107+ < IconButton
108+ id = "importCellTemplateFile"
109+ className = { classes . icon }
110+ onClick = { ( ) => this . showExplorerDialog ( 'fileName' , false ) }
111+ tooltip-data = 'File explorer'
112+ >
113+ < Icon className = 'fa fa-folder-o listIcon' />
114+ </ IconButton >
115+
116+ < NetPyNEField id = "netParams.importCellParams.fileName" >
117+ < TextField
118+ value = { fileName }
119+ onChange = { event => this . setState ( { fileName : event . target . value } ) }
146120 />
147121 </ NetPyNEField >
122+
148123 </ div >
149124
150- < div style = { styles . mods . rightSubContainer } >
151- < NetPyNEField id = "netParams.importCellParams.compileMod" className = "netpyneCheckbox netpyneFieldNoWidth" noStyle >
152- < Checkbox
153- checked = { compileMod }
154- style = { styles . mods . checkbox }
155- id = "importCellTemplateCompileMods"
156- onChange = { ( ) => this . updateCheck ( 'compileMod' ) }
125+
126+ < div className = { classes . container } >
127+ < IconButton
128+ id = "importCellTemplateModFile"
129+ className = { classes . icon }
130+ onClick = { ( ) => this . showExplorerDialog ( 'modFolder' , true ) }
131+ tooltip-data = 'File explorer'
132+ >
133+ < Icon className = "fa fa-folder-o listIcon" />
134+ </ IconButton >
135+
136+ < NetPyNEField id = "netParams.importCellParams.modFolder" >
137+ < TextField
138+ value = { modFolder }
139+ onChange = { event => this . setState ( { modFolder : event . target . value } ) }
157140 />
158141 </ NetPyNEField >
159142 </ div >
160- </ div >
161143
162- < FileBrowser
163- open = { explorerDialogOpen }
164- exploreOnlyDirs = { exploreOnlyDirs }
165- onRequestClose = { selection => this . closeExplorerDialog ( selection ) }
166- />
144+ < div className = "listStyle netpyneField" >
145+ < ListComponent id = "cellArgs" realType = "dict" floatingLabelText = "Cell Template Parameters (key:value pair)" ref = "cellArgs" />
146+ </ div >
147+
148+ < NetPyNEField id = "netParams.importCellParams.importSynMechs" >
149+ < Checkbox
150+ checked = { importSynMechs }
151+ onChange = { ( ) => this . updateCheck ( 'importSynMechs' ) }
152+ />
153+ </ NetPyNEField >
154+
155+ < NetPyNEField id = "netParams.importCellParams.compileMod" >
156+ < Checkbox
157+ checked = { compileMod }
158+ id = "importCellTemplateCompileMods"
159+ onChange = { ( ) => this . updateCheck ( 'compileMod' ) }
160+ />
161+ </ NetPyNEField >
162+
167163
164+ < FileBrowser
165+ open = { explorerDialogOpen }
166+ exploreOnlyDirs = { exploreOnlyDirs }
167+ onRequestClose = { selection => this . closeExplorerDialog ( selection ) }
168+ />
169+ </ div >
168170 </ ActionDialog >
169171 )
170172 }
171173}
174+
175+ export default withStyles ( styles ) ( ImportCellParams )
0 commit comments