Skip to content

Commit 36adf98

Browse files
addChild button added
1 parent 0f5621f commit 36adf98

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/components/LeftColExpansionPanel.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import AddIcon from '@material-ui/icons/Add';
1717

1818
const LeftColExpansionPanel = (props) => {
1919
const {
20-
index, classes, focusComponent, component, deleteComponent,
20+
index, classes, focusComponent, component, deleteComponent, addChild,
2121
} = props;
2222
const { title, id, color } = component;
2323

@@ -39,7 +39,13 @@ const LeftColExpansionPanel = (props) => {
3939
/>
4040
<ListItemSecondaryAction>
4141
<IconButton aria-label="Add">
42-
<AddIcon style={{ color, float: 'right' }} />
42+
<AddIcon
43+
style={{ color, float: 'right' }}
44+
onClick={() => {
45+
console.log(title);
46+
addChild(title);
47+
}}
48+
/>
4349
</IconButton>
4450
</ListItemSecondaryAction>
4551
</ListItem>

src/containers/LeftContainer.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const mapDispatchToProps = dispatch => ({
3030
// moveToTop: componentId => dispatch(actions.moveToTop(componentId)),
3131
// openExpansionPanel: component => dispatch(actions.openExpansionPanel(component)),
3232
// deleteAllData: () => dispatch(actions.deleteAllData()),
33+
addChild: ({ title }) => dispatch(actions.addChild({ title })),
3334
});
3435

3536
class LeftContainer extends Component {
@@ -58,6 +59,7 @@ class LeftContainer extends Component {
5859
focusComponent,
5960
totalComponents,
6061
classes,
62+
addChild,
6163
} = this.props;
6264
const { componentName } = this.state;
6365

@@ -69,6 +71,7 @@ class LeftContainer extends Component {
6971
updateComponent={updateComponent}
7072
component={component}
7173
focusComponent={focusComponent}
74+
addChild={addChild}
7275
/>
7376
));
7477

0 commit comments

Comments
 (0)