-
Notifications
You must be signed in to change notification settings - Fork 860
Expand file tree
/
Copy pathKeyRender.js
More file actions
38 lines (36 loc) · 1.03 KB
/
KeyRender.js
File metadata and controls
38 lines (36 loc) · 1.03 KB
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
'use strict';
import React, { Component } from 'react';
export default class KeyRender extends Component {
Render () {
var classString = 'key key-' + props.keyType;
if(state.isHighlighted) {
classString += ' highlight';
}
var classOperation = '';
if(props.keyType === 'operator') {
classOperation = 'operator ' + props.keyValue;
}
if(props.keyType === 'action') {
classOperation = 'action ' + props.keyValue;
}
if(props.keyType === 'number') {
return (
<div className={classString}
onClick={this.handleClick}
onMouseDown={this.onMouseDown}
onMouseUp={this.onMouseUp}>
<div className={classOperation}>{props.keySymbol}</div>
</div>
);
} else {
return (
<div className={classString}>
<div className={classOperation}
onClick={this.handleClick}
onMouseDown={this.onMouseDown}
onMouseUp={this.onMouseUp}>{props.keySymbol}</div>
</div>
);
}
}
}