Skip to content

Commit 325ecb2

Browse files
committed
Merge branch 'stretch' of https://github.com/oslabs-beta/ReacType into testing
2 parents ab66115 + b1bca3b commit 325ecb2

File tree

11 files changed

+527
-329
lines changed

11 files changed

+527
-329
lines changed

src/components/bottom/BottomPanel.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import React, { Component } from 'react';
22
import { connect } from 'react-redux';
3-
import { handleClose, deleteProp, addProp, toggleNative, changeComponentFocusChild } from '../../actions/actionCreators';
3+
import {
4+
handleClose,
5+
deleteProp,
6+
addProp,
7+
toggleNative,
8+
changeComponentFocusChild
9+
} from '../../actions/actionCreators';
410
import BottomTabs from './BottomTabs';
511
import { PropsInt, PropInt } from '../../interfaces/Interfaces';
612
import { toggleCodeEdit } from '../../actions/actionCreators';
@@ -12,7 +18,7 @@ const mapDispatchToProps = (dispatch: any) => ({
1218
deleteProp: (id: number) => dispatch(deleteProp(id)),
1319
handleNotificationClose: () => dispatch(handleClose()),
1420
toggleNative: () => dispatch(toggleNative()),
15-
toggleCodeEdit: () => dispatch(toggleCodeEdit()),
21+
toggleCodeEdit: () => dispatch(toggleCodeEdit())
1622
});
1723

1824
const mapStateToProps = (store: any) => ({
@@ -64,8 +70,6 @@ class BottomPanel extends Component<BottomPanelPropsInt> {
6470
focusChild={focusChild}
6571
changeFocusComponent={changeFocusComponent}
6672
updateCode={updateCode}
67-
toggleNative={toggleNative}
68-
native={native}
6973
toggleCodeEdit={toggleCodeEdit}
7074
codeReadOnly={codeReadOnly}
7175
/>

src/components/bottom/BottomTabs.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,15 @@ class BottomTabs extends Component<BottomTabsPropsInt, StateInt> {
202202
htmlAttribCount ? `(${htmlAttribCount})` : ''
203203
} `}
204204
/>
205-
<Tab
205+
{/* <Tab
206206
disableRipple
207207
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
208208
label="Add Child Props"
209-
/>
209+
/> */}
210210
</Tabs>
211-
<FormGroup>
211+
{
212+
// REACT NATIVE TOGGLE REMOVED AND MOVED TO LEFTCONTAINER. REMOVE THIS CODE IF NO ADVERSE EFFECTS FOUND
213+
/* <FormGroup>
212214
<FormControlLabel
213215
className={classes.switch}
214216
control={
@@ -223,7 +225,8 @@ class BottomTabs extends Component<BottomTabsPropsInt, StateInt> {
223225
label="Native Mode"
224226
labelPlacement="start"
225227
/>
226-
</FormGroup>
228+
</FormGroup> */
229+
}
227230
</Box>
228231
{value === 0 && (
229232
<div

src/components/bottom/Props.tsx

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import TextField from '@material-ui/core/TextField';
77
import Button from '@material-ui/core/Button';
88
import Select from '@material-ui/core/Select';
99
import InputLabel from '@material-ui/core/InputLabel';
10-
import { addProp, changeComponentFocusChild, deleteProp } from '../../actions/actionCreators';
10+
import {
11+
addProp,
12+
changeComponentFocusChild,
13+
deleteProp
14+
} from '../../actions/actionCreators';
1115
import DataTable from './DataTable';
1216
import { PropInt, PropsInt } from '../../interfaces/Interfaces';
1317

@@ -147,7 +151,7 @@ const mapDispatchToProps = (dispatch: any) => ({
147151
}: {
148152
componentId: number;
149153
childId: number;
150-
}) => dispatch(changeComponentFocusChild({ componentId, childId })),
154+
}) => dispatch(changeComponentFocusChild({ componentId, childId }))
151155
});
152156

153157
const mapStateToProps = (store: any) => ({
@@ -198,8 +202,12 @@ class Props extends Component<PropsPropsInt, StateInt> {
198202
}
199203

200204
// using useState to locally check a clickedValue
201-
202-
handleChange = (event: any) => {
205+
// React.ChangeEvent<HTML...Element> is the correct typing for events
206+
handleChange = (
207+
event:
208+
| React.ChangeEvent<HTMLInputElement>
209+
| React.ChangeEvent<HTMLSelectElement>
210+
) => {
203211
if (event.target.id === 'propVariable') {
204212
this.setState({
205213
[event.target.id]: event.target.value.trim()
@@ -251,15 +259,16 @@ class Props extends Component<PropsPropsInt, StateInt> {
251259
type: propType
252260
});
253261

254-
this.props.changeComponentFocusChild({ componentId: this.props.focusComponent.id , childId: this.props.focusChild.childId});
262+
this.props.changeComponentFocusChild({
263+
componentId: this.props.focusComponent.id,
264+
childId: this.props.focusChild.childId
265+
});
255266
this.setState({
256267
propVariable: '',
257268
propValue: '',
258269
propRequired: true,
259270
propType: ''
260271
});
261-
262-
263272
};
264273

265274
render() {
@@ -312,19 +321,28 @@ class Props extends Component<PropsPropsInt, StateInt> {
312321
>
313322
<Grid container spacing={8}>
314323
<Grid item xs={3}>
315-
<form className="props-input" onSubmit={this.handleAddProp}>
324+
<form
325+
className="props-input"
326+
// JZ: assigned typing to onSubmit event, matches handleAddProp func
327+
onSubmit={(event: React.ChangeEvent<HTMLFormElement>) =>
328+
this.handleAddProp(event)
329+
}
330+
>
316331
<Grid container spacing={8}>
317332
<Grid item xs={6}>
318333
<FormControl>
319334
<TextField
320335
type="text"
321-
native
336+
// native commented out due to overload error with material
322337
id="propVariable"
323338
label="Prop"
324339
margin="none"
325340
autoFocus
326341
size="medium"
327-
onChange={this.handleChange}
342+
onChange={(
343+
//JZ: assigned typing to incoming event
344+
event: React.ChangeEvent<HTMLInputElement>
345+
) => this.handleChange(event)}
328346
value={this.state.propVariable}
329347
color={'primary'}
330348
required

0 commit comments

Comments
 (0)