Skip to content

Commit c6f6fdd

Browse files
committed
Merge branch 'staging' of https://github.com/oslabs-beta/ReacType into feature
2 parents 21d0e6b + a157dde commit c6f6fdd

File tree

6 files changed

+194
-96
lines changed

6 files changed

+194
-96
lines changed

src/components/BottomPanel.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { connect } from 'react-redux';
33
import { handleClose, deleteProp, addProp } from '../actions/components';
44
import BottomTabs from './BottomTabs';
55
import { PropsInt, PropInt } from '../utils/Interfaces';
6+
import { changeFocusComponent } from '../utils/componentReducer.util';
67

78
const IPC = require('electron').ipcRenderer;
89

@@ -20,11 +21,19 @@ const mapStateToProps = (store: any) => ({
2021
interface BottomPanelPropsInt extends PropsInt {
2122
deleteProp(id: number): void;
2223
addProp(prop: PropInt): void;
24+
changeFocusComponent(arg: { title: string }): void;
2325
}
2426

2527
class BottomPanel extends Component<BottomPanelPropsInt> {
2628
render() {
27-
const { components, focusComponent, deleteProp, addProp, focusChild } = this.props;
29+
const {
30+
components,
31+
focusComponent,
32+
deleteProp,
33+
addProp,
34+
focusChild,
35+
changeFocusComponent
36+
} = this.props;
2837

2938
return (
3039
<div className="bottom-panel" style={{ width: '100%' }}>
@@ -34,6 +43,7 @@ class BottomPanel extends Component<BottomPanelPropsInt> {
3443
deleteProp={deleteProp}
3544
addProp={addProp}
3645
focusChild={focusChild}
46+
changeFocusComponent={changeFocusComponent}
3747
/>
3848
</div>
3949
);

src/components/BottomTabs.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface BottomTabsPropsInt extends PropsInt {
1212
deleteProp(id: number): void;
1313
addProp(prop: PropInt): void;
1414
classes: any;
15+
changeFocusComponent(arg: { title: string }): void;
1516
}
1617

1718
// interface TreeInt {
@@ -102,6 +103,10 @@ class BottomTabs extends Component<BottomTabsPropsInt, StateInt> {
102103
this.setState({ value });
103104
};
104105

106+
handleClick = (event: any, node: any) => {
107+
this.props.changeFocusComponent({ title: event.name });
108+
};
109+
105110
generateComponentTree(componentId: number, components: ComponentsInt) {
106111
const component = components.find(comp => comp.id === componentId);
107112
const tree: any = { name: component.title, attributes: {}, children: [] };
@@ -177,6 +182,7 @@ class BottomTabs extends Component<BottomTabsPropsInt, StateInt> {
177182
separation={{ siblings: 0.3, nonSiblings: 0.3 }}
178183
transitionDuration={0}
179184
translate={this.state.translate}
185+
onClick={this.handleClick}
180186
styles={{
181187
nodes: {
182188
node: {

0 commit comments

Comments
 (0)