Skip to content

Commit 300f549

Browse files
author
rodriguez-facundo
committed
Styling, removing px use in css
1 parent cd615fe commit 300f549

18 files changed

Lines changed: 270 additions & 216 deletions

File tree

webapp/Theme.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ const primaryColor = 'rgb(84, 58, 115)'
1212
export default createMuiTheme({
1313
typography: {
1414
useNextVariants: true,
15-
htmlFontSize: 14,
16-
fontSize: 14,
15+
htmlFontSize: 12,
16+
fontSize: 10,
1717
fontFamily: 'Roboto, Helvetica, Arial, sans-serif',
1818
button: {
1919
textTransform: "none",
@@ -33,14 +33,13 @@ export default createMuiTheme({
3333
boxShadow: 'none !important'
3434
},
3535
},
36-
MuiIconButton:{ root: { '&:hover': { backgroundColor: 'inherit' } } },
3736
MuiSelect: {
3837
root: {
3938
outline: 'none !important',
4039
border: 'none !important',
4140
boxShadow: 'none !important'
4241
},
43-
select: { "&:focus" :{ background: "none" } }
44-
},
42+
select: { "&:focus" :{ background: "none" } },
43+
}
4544
}
4645
});

webapp/components/definition/cellRules/NetPyNECellRules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ export default class NetPyNECellRules extends React.Component {
591591
<div className='ml-2'>
592592
<Fab
593593
id="newCellRuleButton"
594-
style={{ minWidth: 56 }}
594+
style={{ width: 70, height: 70 }}
595595
color={ page == 'main' ? 'primary' : 'secondary'}
596596
data-tooltip={ this.createTooltip('cellRule')}
597597
onClick={() => this.handleHierarchyClick('main')}

webapp/components/definition/cellRules/sections/NetPyNESectionThumbnail.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import FontIcon from '@material-ui/core/Icon';
33
import Button from '@material-ui/core/Button';
44
import DeleteDialogBox from '../../../general/DeleteDialogBox';
55

6-
const styles = { btn: { borderRadius: '25px' } };
6+
const styles = { btn: { borderRadius: '25px', marginRight: '8px' } };
77

88
export default class NetPyNESectionThumbnail extends React.Component {
99

@@ -46,7 +46,7 @@ export default class NetPyNESectionThumbnail extends React.Component {
4646
<Button
4747
variant="contained"
4848
id={name}
49-
color="primary"
49+
color={selected ? 'secondary' : 'primary'}
5050
style={ styles.btn }
5151
onMouseEnter={ () => this.setState({ isHovered: true }) }
5252
onMouseLeave={ () => this.setState({ isHovered: false }) }

webapp/components/definition/cellRules/sections/mechanisms/NetPyNEMechanism.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
import React from 'react';
22
import TextField from '@material-ui/core/TextField';
33
import Utils from '../../../../../Utils';
4+
import { withStyles } from '@material-ui/core/styles';
45

56
var PythonControlledCapability = require('geppetto-client/js/communication/geppettoJupyter/PythonControlledCapability');
67
var PythonControlledTextField = PythonControlledCapability.createPythonControlledControl(TextField);
78

8-
export default class NetPyNEMechanism extends React.Component {
9+
const styles = ({ spacing }) => ({
10+
fields: {
11+
marginTop: spacing(3),
12+
width: '100%'
13+
}
14+
})
15+
class NetPyNEMechanism extends React.Component {
916

1017
constructor (props) {
1118
super(props);
@@ -19,18 +26,19 @@ export default class NetPyNEMechanism extends React.Component {
1926
this.setState({ currentName: nextProps.name });
2027
}
2128

22-
renderMechFields = () => {
29+
renderMechFields = classes => {
2330
if (this.state.mechFields == '') {
2431
return <div key={"empty"}/>
2532
} else {
2633
var tag = "netParams.cellParams['" + this.props.cellRule + "']['secs']['" + this.props.section + "']['mechs']['" + this.state.currentName + "']"
2734
return this.state.mechFields.map((name, i) =>
28-
<PythonControlledTextField id={"mechName" + name} name={name} key={name} model={tag + "['" + name + "']"} label={name} realType={"float"} style={{ width:'100%' }}/>
35+
<PythonControlledTextField id={"mechName" + name} name={name} key={name} model={tag + "['" + name + "']"} label={name} realType={"float"} className={classes.fields}/>
2936
)
3037
}
3138
};
3239

3340
render () {
41+
const { classes } = this.props
3442
var content = []
3543
if (this.state.currentName != undefined && this.state.currentName != '') {
3644
Utils
@@ -40,7 +48,7 @@ export default class NetPyNEMechanism extends React.Component {
4048
this.setState({ mechFields: response })
4149
}
4250
})
43-
content.push(this.renderMechFields())
51+
content.push(this.renderMechFields(classes))
4452
}
4553

4654
return (
@@ -59,3 +67,4 @@ export default class NetPyNEMechanism extends React.Component {
5967
);
6068
}
6169
}
70+
export default withStyles(styles)(NetPyNEMechanism)

webapp/components/definition/cellRules/sections/mechanisms/NetPyNEMechanismThumbnail.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ const hoverColor = '#66d2e2';
77
const changeColor = 'rgb(0, 188, 212)';
88

99
const styles = {
10-
main: { float: 'left' },
10+
main: { float: 'left', '&:hover': { backgroundColor: 'red' } },
1111
trash: {
1212
zIndex:10,
1313
marginTop:37,
14-
marginLeft:37,
14+
marginLeft:38,
1515
position:"absolute",
1616
backgroundColor:"#f23d7a",
1717
color: 'white'
@@ -47,7 +47,7 @@ export default class NetPyNEMechanismThumbnail extends React.Component {
4747
}
4848

4949
render () {
50-
const { name, selected } = this.props;
50+
const { name, selected, classes } = this.props;
5151
const { dialogOpen, isHovered } = this.state;
5252
let label;
5353
if (isHovered && selected) {
@@ -62,8 +62,7 @@ export default class NetPyNEMechanismThumbnail extends React.Component {
6262
return (
6363
<div style={styles.main}>
6464
<IconButton
65-
disableFocusRipple
66-
disableRipple
65+
style={{ '&:hover': { backgroundColor: 'red' } }}
6766
id={`mechThumb${name}`}
6867
onMouseEnter={ () => this.setState({ isHovered: true }) }
6968
onMouseLeave={ () => this.setState({ isHovered: false }) }

webapp/components/definition/cellRules/sections/mechanisms/NetPyNENewMechanism.js

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,15 @@ import Menu from '@material-ui/core/Menu';
33
import MenuItem from '@material-ui/core/MenuItem';
44
import NavigationMoreHoriz from '@material-ui/icons/MoreHoriz';
55
import { withStyles } from '@material-ui/core/styles'
6-
import Icon from '@material-ui/core/Icon'
76
import Utils from '../../../../../Utils';
87
import ContentAdd from '@material-ui/icons/Add'
98

10-
const styless = ({ spacing, palette }) => ({
9+
const styles = ({ spacing, palette }) => ({
1110
icon : { color: palette.primary.main },
12-
disabledIcon : { color: '#d1d1d1', cursor: 'auto' },
11+
disabledIcon : { color: '#d1d1d1', cursor: 'auto' },
12+
iconContent: { position: 'absolute', color: 'white', top: '17px', left: '17px' },
1313
})
1414

15-
16-
const hoverColor = '#66d2e2';
17-
// const changeColor = 'rgb(0, 188, 212)';
18-
19-
const styles = {
20-
anchorOrigin: {
21-
horizontal: 'left',
22-
vertical: 'bottom'
23-
},
24-
anchorTarget: {
25-
horizontal: 'left',
26-
vertical: 'top'
27-
},
28-
color: 'white'
29-
};
30-
3115
class NetPyNENewMechanism extends React.Component {
3216

3317
constructor (props) {
@@ -71,15 +55,15 @@ class NetPyNENewMechanism extends React.Component {
7155
}
7256
}
7357

74-
createLabel (){
58+
createLabel (classes){
7559
const { disabled, blockButton } = this.props;
7660
if (disabled) {
7761
return ""
7862
} else {
7963
if (blockButton) {
80-
return <NavigationMoreHoriz style={{ position: 'absolute', color: 'white', top: '15px', left: '15px' }}/>
64+
return <NavigationMoreHoriz className={classes.iconContent}/>
8165
} else {
82-
return <ContentAdd style={{ position: 'absolute', color: 'white', top: '15px', left: '15px' }}/>
66+
return <ContentAdd className={classes.iconContent}/>
8367
}
8468
}
8569
}
@@ -100,7 +84,7 @@ class NetPyNENewMechanism extends React.Component {
10084
style={{ fontSize: '56px' }}
10185
className="gpt-fullgear"
10286
/>
103-
{this.createLabel()}
87+
{this.createLabel(classes)}
10488
</div>
10589

10690
</div>
@@ -127,4 +111,4 @@ class NetPyNENewMechanism extends React.Component {
127111
}
128112
}
129113

130-
export default withStyles(styless)(NetPyNENewMechanism)
114+
export default withStyles(styles)(NetPyNENewMechanism)

webapp/components/definition/connectivity/NetPyNEConnectivityRule.js

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ import NetPyNECoordsRange from '../../general/NetPyNECoordsRange';
1212
import Dialog from '@material-ui/core/Dialog/Dialog';
1313
import Button from '@material-ui/core/Button';
1414

15+
16+
import DialogActions from '@material-ui/core/DialogActions';
17+
import DialogContent from '@material-ui/core/DialogContent';
18+
import DialogContentText from '@material-ui/core/DialogContentText';
19+
import DialogTitle from '@material-ui/core/DialogTitle';
20+
1521
var PythonControlledCapability = require('geppetto-client/js/communication/geppettoJupyter/PythonControlledCapability');
1622
var PythonControlledTextField = PythonControlledCapability.createPythonControlledControl(TextField);
1723
var PythonMethodControlledSelectField = PythonControlledCapability.createPythonControlledControlWithPythonDataFetch(Select);
@@ -104,24 +110,26 @@ export default class NetPyNEConnectivityRule extends React.Component {
104110
}
105111

106112
render () {
107-
var actions = [
108-
<Button
109-
variant="contained"
110-
color="primary"
111-
label={"BACK"}
112-
onTouchTap={() => this.setState({ errorMessage: undefined, errorDetails: undefined })}
113-
/>
114-
];
115-
var title = this.state.errorMessage;
116-
var children = this.state.errorDetails;
117-
var dialogPop = (this.state.errorMessage != undefined) ? <Dialog
118-
title={title}
119-
open={true}
120-
actions={actions}
121-
bodyStyle={{ overflow: 'auto' }}
122-
style={{ whiteSpace: "pre-wrap" }}>
123-
{children}
124-
</Dialog> : undefined;
113+
var dialogPop = (this.state.errorMessage != undefined) ? (
114+
<Dialog
115+
open={true}
116+
style={{ whiteSpace: "pre-wrap" }}>
117+
<DialogTitle id="alert-dialog-title">{this.state.errorMessage}</DialogTitle>
118+
<DialogContent style={{ overflow: 'auto' }}>
119+
<DialogContentText id="alert-dialog-description">
120+
{this.state.errorDetails}
121+
</DialogContentText>
122+
</DialogContent>
123+
<DialogActions>
124+
<Button
125+
variant="contained"
126+
color="primary"
127+
onClick={() => this.setState({ errorMessage: undefined, errorDetails: undefined })}
128+
>BACK</Button>
129+
</DialogActions>
130+
</Dialog>
131+
)
132+
: undefined
125133

126134
if (this.state.sectionId == "General") {
127135
var content = (

webapp/components/definition/populations/Dimensions.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,28 @@ import TextField from '@material-ui/core/TextField';
33
import Select from '@material-ui/core/Select';
44
import MenuItem from '@material-ui/core/MenuItem';
55
import Utils from '../../../Utils';
6+
import { withStyles } from '@material-ui/core/styles';
67

78
import NetPyNEField from '../../general/NetPyNEField';
89
var PythonControlledCapability = require('geppetto-client/js/communication/geppettoJupyter/PythonControlledCapability');
910

1011
var PythonControlledTextField = PythonControlledCapability.createPythonControlledControl(TextField);
1112

13+
const styles = ({ spacing }) => ({
14+
selectField: {
15+
marginTop: spacing(3),
16+
width: '100%'
17+
},
18+
field:{
19+
width: '95%!important',
20+
marginLeft: spacing(3)
21+
}
22+
})
23+
1224
/**
1325
* Population Dimensions Component
1426
*/
15-
export default class DimensionsComponent extends Component {
27+
class DimensionsComponent extends Component {
1628

1729
constructor (props) {
1830
super(props);
@@ -78,10 +90,10 @@ export default class DimensionsComponent extends Component {
7890
}
7991

8092
render () {
81-
93+
const { classes } = this.props
8294
return (
8395
<div>
84-
<NetPyNEField id="netParams.popParams.numCells" className={"netpyneFieldNoWidth"} noStyle>
96+
<NetPyNEField id="netParams.popParams.numCells" className={classes.selectField}>
8597
<Select
8698
id={"popParamsDimensionsSelect"}
8799
value={this.state.dimension}
@@ -101,7 +113,7 @@ export default class DimensionsComponent extends Component {
101113
</NetPyNEField>
102114
{
103115
this.state.dimension != undefined && this.state.dimension != ""
104-
? <NetPyNEField id={"netParams.popParams." + this.state.dimension} className={"netpyneRightField"} noStyle>
116+
? <NetPyNEField id={"netParams.popParams." + this.state.dimension} className={classes.fields}>
105117
<PythonControlledTextField
106118
id={"popParamsDimensions"}
107119
handleChange={this.handleDimValueChange}
@@ -116,3 +128,5 @@ export default class DimensionsComponent extends Component {
116128
)
117129
}
118130
}
131+
132+
export default withStyles(styles)(DimensionsComponent)

0 commit comments

Comments
 (0)