-
Notifications
You must be signed in to change notification settings - Fork 221
/
Copy pathindex.tsx
32 lines (27 loc) · 923 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
30
31
32
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
? this.props.stores.ApplicationStore.setLocale('取消', 'Cancel')
: this.props.stores.ApplicationStore.setLocale('预览', '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,
};