-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparent_component.tsx
62 lines (55 loc) · 1.52 KB
/
parent_component.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import * as React from "react";
import { PropertyControls, ControlType } from "framer";
import { BlueComponent } from "./blue_component";
import { GreenComponent } from "./green_component";
const style: React.CSSProperties = {
height: "100%",
display: "flex",
alignItems: "center",
justifyContent: "center",
textAlign: "center",
color: "#8855FF",
background: "rgba(136, 85, 255, 0.1)",
overflow: "hidden",
};
// Define type of property
interface Props {
text: string;
blueText: string;
greenText: string;
hoverColor: string;
backgroundColor: string;
backgroundColorHover: string;
width: number;
height: number;
}
export class parent_component extends React.Component<Props> {
constructor(props)
{
super(props);
}
// Set default properties
static defaultProps = {
blueText: "this is blue",
greenText: "this is green",
text: "Hello World!",
}
// Items shown in property panel
static propertyControls: PropertyControls = {
text: { type: ControlType.String, title: "Text" },
blueText: { type: ControlType.String, title: "Blue Text" },
greenText: { type: ControlType.String, title: "Green Text" },
}
render() {
const { ...otherProperties } = this.props;
return <div>
<div>{this.props.text}</div>
<div>
<GreenComponent {...otherProperties}></GreenComponent>
</div>
<div>
<BlueComponent {...otherProperties}></BlueComponent>
</div>
</div>
}
}