forked from ascoders/gaea-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
29 lines (25 loc) · 833 Bytes
/
index.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
import { Connect } from "dob-react"
import * as React from "react"
import { Props, State } from "./index.type"
import * as Styled from "./style"
@Connect
class Preview extends React.Component<Props, State> {
public static defaultProps = new Props()
public state = new State()
public render() {
return (
<Styled.Container onClick={this.handleClick}>
{this.props.stores.ApplicationStore.isPreview ? "Cancel" : "Preview"}
</Styled.Container>
)
}
private handleClick = () => {
const setPreview = !this.props.stores.ApplicationStore.isPreview
this.props.actions.ApplicationAction.resetApplication()
this.props.actions.ApplicationAction.setPreview(setPreview)
}
}
export default {
position: "navbarRight",
class: Preview
}