-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblue_component.tsx
55 lines (50 loc) · 1.34 KB
/
blue_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
import * as React from "react";
import { PropertyControls, ControlType } from "framer";
import styled from "styled-components";
const BlueBox = styled.div`
position: relative;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
border-radius: 2px;
background-color: ${(p: Partial<Props>) => p.backgroundColor};
&:hover {
background-color: ${(p: Partial<Props>) => p.hoverColor};
}
`;
interface Props {
blueText: string;
hoverColor: string;
backgroundColor: string;
width: number;
height: number;
}
export class BlueComponent extends React.Component<Props> {
constructor(props)
{
super(props);
this.state = { color : '#4cb96b' };
}
// Set default properties
static defaultProps = {
blueText: "Hello Blue Component",
backgroundColor: "blue",
hoverColor: "purple",
width: 160,
height: 48,
};
// Items shown in property panel
static propertyControls: PropertyControls = {
blueText: { type: ControlType.String, title: "Text" },
}
render() {
return <BlueBox
backgroundColor={this.props.backgroundColor}
hoverColor={this.props.hoverColor}
height={this.props.height}
width={this.props.width}
>{this.props.blueText}</BlueBox>;
}
}