Skip to content

Commit 6875668

Browse files
committed
working on grid styling, Co-authored-by: Philip Hua <[email protected]>
Co-authored-by: Miles Wright <[email protected]> Co-authored-by: William Rittwage <[email protected]> Co-authored-by: Daniel Reilley <[email protected]>
1 parent 113a00b commit 6875668

File tree

3 files changed

+81
-11
lines changed

3 files changed

+81
-11
lines changed

app/src/components/right/StatePropsPanel.tsx

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ const StatePropsPanel = ({ isThemeLight }): JSX.Element => {
123123
<div className={'state-panel'}>
124124
<div>
125125
<FormControl>
126-
<h4>Create New State</h4>
126+
<h4 className={isThemeLight ? classes.lightThemeFontColor : classes.darkThemeFontColor}>Create New State</h4>
127127
<TextField
128128
id="textfield-key"
129129
label="key:"
@@ -140,12 +140,16 @@ const StatePropsPanel = ({ isThemeLight }): JSX.Element => {
140140
value={inputValue}
141141
onChange={(e) => setInputValue(e.target.value)}
142142
/>
143-
<FormControl required className={classes.formControl}>
144-
<InputLabel id="select-required-label">Type</InputLabel>
143+
<FormControl required className={isThemeLight ? `${classes.formControl} ${classes.lightThemeFontColor}` : `${classes.formControl} ${classes.darkThemeFontColor}`}>
144+
<InputLabel
145+
id="select-required-label"
146+
className={isThemeLight ? classes.greyThemeFontColor : classes.darkThemeFontColor}>
147+
Type
148+
</InputLabel>
145149
<Select
146150
labelId="select-required-label"
147151
id="type-input"
148-
className={classes.selectEmpty}
152+
className={isThemeLight ? `${classes.selectEmpty} ${classes.rootUnderlineLight}` : `${classes.selectEmpty} ${classes.rootUnderlineDark}`}
149153
value={inputType}
150154
onChange={(event, index) => setInputType(index.props.value)}
151155
>
@@ -171,7 +175,10 @@ const StatePropsPanel = ({ isThemeLight }): JSX.Element => {
171175
Any
172176
</MenuItem>
173177
</Select>
174-
<FormHelperText>Required</FormHelperText>
178+
<FormHelperText
179+
className={isThemeLight ? classes.greyThemeFontColor : classes.darkThemeFontColor}>
180+
Required
181+
</FormHelperText>
175182
</FormControl>
176183
<br></br>
177184
<MyButton
@@ -186,8 +193,10 @@ const StatePropsPanel = ({ isThemeLight }): JSX.Element => {
186193
</div>
187194
<br></br>
188195
<div>
189-
<h4>Current State Name: {state.components[state.canvasFocus.componentId - 1].name}</h4>
190-
<TableStateProps selectHandler={handlerRowSelect} deleteHandler={handlerRowDelete} />
196+
<h4 className={isThemeLight ? classes.lightThemeFontColor : classes.darkThemeFontColor}>
197+
Current State Name: {state.components[state.canvasFocus.componentId - 1].name}
198+
</h4>
199+
<TableStateProps selectHandler={handlerRowSelect} deleteHandler={handlerRowDelete} isThemeLight={isThemeLight} />
191200
</div>
192201
</div>
193202
);
@@ -293,6 +302,9 @@ const useStyles = makeStyles((theme: Theme) =>
293302
darkThemeFontColor: {
294303
color: "#fff",
295304
},
305+
greyThemeFontColor: {
306+
color: 'rgba(0,0,0,0.54)',
307+
},
296308
formControl: {
297309
margin: theme.spacing(1),
298310
minWidth: 120,
@@ -315,6 +327,30 @@ const useStyles = makeStyles((theme: Theme) =>
315327
'& .MuiOutlinedInput-notchedOutline': {
316328
borderColor: '#fff'
317329
}
330+
},
331+
underlineDark: {
332+
borderBottom: '1px solid white'
333+
334+
},
335+
rootUnderlineDark: {
336+
'& .MuiSelect-icon': {
337+
color: '#fff',
338+
},
339+
// '& .MuiInput-underline': {
340+
'&::before': {
341+
borderBottom: '1px solid #fff'
342+
}
343+
// }
344+
},
345+
rootUnderlineLight: {
346+
'& .MuiSelect-icon': {
347+
color: 'rgba(0,0,0,0.54)',
348+
},
349+
// '& .MuiInput-underline': {
350+
'&::before': {
351+
borderBottom: '1px solid rgba(0,0,0,0.54)'
352+
}
353+
// }
318354
}
319355
})
320356
);

app/src/components/right/TableStateProps.tsx

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,46 @@ import {
77
import Button from '@material-ui/core/Button';
88
import ClearIcon from '@material-ui/icons/Clear';
99
import StateContext from '../../context/context';
10+
import { makeStyles } from '@material-ui/core/styles';
1011

1112
import { StatePropsPanelProps } from '../../interfaces/Interfaces';
1213

1314
const getColumns = (props) => {
1415
const { deleteHandler } : StatePropsPanelProps = props;
16+
console.log('isThemeLight: ',props.isThemeLight)
1517
return [
1618
{
1719
field: 'id',
1820
headerName: 'ID',
21+
headerClassName: props.isThemeLight ? 'classes.themeLight' : 'classes.themeDark',
1922
width: 70,
2023
editable: false,
2124
},
2225
{
2326
field: 'key',
2427
headerName: 'Key',
28+
headerClassName: props.isThemeLight ? 'classes.themeLight' : 'classes.themeDark',
2529
width: 90,
2630
editable: true,
2731
},
2832
{
2933
field: 'value',
3034
headerName: 'Value',
35+
headerClassName: props.isThemeLight ? 'classes.themeLight' : 'classes.themeDark',
3136
width: 90,
3237
editable: true,
3338
},
3439
{
3540
field: 'type',
3641
headerName: 'Type',
42+
headerClassName: props.isThemeLight ? 'classes.themeLight' : 'classes.themeDark',
3743
width: 90,
3844
editable: false,
3945
},
4046
{
4147
field: 'delete',
4248
headerName: 'X',
49+
headerClassName: props.isThemeLight ? 'classes.themeLight' : 'classes.themeDark',
4350
width: 70,
4451
editable: false,
4552
renderCell: function renderCell(params:any) {
@@ -50,9 +57,9 @@ const getColumns = (props) => {
5057
};
5158
return (
5259
<Button style={{width:`${3}px`}}
53-
onClick={() => {
54-
deleteHandler(getIdRow());
55-
}}>
60+
onClick={() => {
61+
deleteHandler(getIdRow());
62+
}}>
5663
<ClearIcon style={{width:`${15}px`}}/>
5764
</Button>
5865
);
@@ -62,14 +69,20 @@ const getColumns = (props) => {
6269
};
6370

6471
const TableStateProps = (props) => {
72+
const classes = useStyles();
6573
const [state] = useContext(StateContext);
6674
const [editRowsModel] = useState <GridEditRowsModel> ({});
6775
const [gridColumns, setGridColumns] = useState([]);
76+
6877

78+
useEffect(() => {
79+
console.log('isThemeLight: ',props.isThemeLight)
80+
setGridColumns(getColumns(props));
81+
}, [props.isThemeLight])
6982
// get currentComponent by using currently focused component's id
7083
const currentId = state.canvasFocus.componentId;
7184
const currentComponent = state.components[currentId - 1];
72-
85+
7386
const rows = currentComponent.stateProps.slice();
7487

7588
const { selectHandler } : StatePropsPanelProps = props;
@@ -87,9 +100,21 @@ const TableStateProps = (props) => {
87100
pageSize={5}
88101
editRowsModel={editRowsModel}
89102
onRowClick = {selectHandler}
103+
headerClassName: props.isThemeLight ? 'classes.themeLight' : 'classes.themeDark',
104+
90105
/>
91106
</div>
92107
);
93108
};
94109

110+
111+
const useStyles = makeStyles({
112+
themeLight: {
113+
color: 'rbga(0,0,0,054)'
114+
},
115+
themeDark: {
116+
color: 'white'
117+
}
118+
});
119+
95120
export default TableStateProps;

app/src/containers/CustomizationPanel.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,15 @@ const useStyles = makeStyles({
735735
border: isThemeLight ? '1px solid #808080' : '1px solid #ECECEA'
736736
}
737737
}),
738+
// buttonRow: {
739+
// textAlign: 'center',
740+
// marginTop: '25px',
741+
// '& .MuiButton-textSecondary': {
742+
// color: '#808080', // color for delete page
743+
// border: '1px solid #808080'
744+
// }
745+
// },
746+
738747
button: {
739748
fontSize: '1rem',
740749
paddingLeft: '20px',

0 commit comments

Comments
 (0)