-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
50 lines (47 loc) · 1.35 KB
/
index.js
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
import React from 'react';
import Svg from '../svg';
import chevron from './assets/chevron.svg';
import './styles.scss';
module.exports = class TestOne extends React.Component {
constructor(props) {
super(props);
this.state = {
'BOOM': false,
clicked: false
};
this.onMouseOver = this.onMouseOver.bind(this);
this.onClick = this.onClick.bind(this);
}
onMouseOver(boom) {
this.setState({
'BOOM': boom
});
}
onClick() {
this.setState({
clicked: true
});
}
render() {
const { locale, one } = this.props;
const { BOOM, clicked } = this.state;
return (
<div
className={`toga-test-one${BOOM ? ' highlighted' : ''}${clicked ? ' clicked' : ''}`}
onMouseOver={() => this.onMouseOver(true)}
onMouseOut={() => this.onMouseOver(false)}
onClick={() => this.onClick()}
>
<div>
<h2>Example: One Component</h2>
<p>This example is used to test a HTML page containing a single component</p>
</div>
<div id="test-locale">locale : {locale}</div>
<div id="test-props">props (one) : {one}</div>
<div id="test-clicked">clicked : {clicked.toString()}</div>
<div id="test-highlighted">highlighted : {BOOM.toString()}</div>
<div id="test-svg"><Svg markup={ chevron }/></div>
</div>
);
}
};