]> git.wincent.com - hextrapolate.git/blob - src/App.js
81bef695c3fbeebcebe4e2c3287741b7a15a4964
[hextrapolate.git] / src / App.js
1 /**
2  * Copyright 2015-present Greg Hurrell. All rights reserved.
3  * Licensed under the terms of the MIT license.
4  *
5  * @flow
6  */
7
8 'use strict';
9
10 import React from 'react';
11 import type Value from './Field.react';
12 import Field from './Field.react';
13 import Label from './Label.react';
14
15 require('./App.css');
16
17 export default class App extends React.Component {
18   constructor(props) {
19     super(props);
20     this.state = {
21       value: null,
22     };
23   }
24
25   _onValueChange = (value: Value) => {
26     this.setState({value});
27   }
28
29   render() {
30     return (
31       <div className="hextrapolate">
32         <h1>Hextrapolate</h1>
33         <Label text="Hexadecimal">
34           <Field
35             base={16}
36             onValueChange={this._onValueChange}
37             value={this.state.value}
38           />
39         </Label>
40         <Label text="Decimal">
41           <Field
42             onValueChange={this._onValueChange}
43             value={this.state.value}
44           />
45         </Label>
46         <Label text="Octal">
47           <Field
48             base={8}
49             onValueChange={this._onValueChange}
50             value={this.state.value}
51           />
52         </Label>
53         <Label text="Binary">
54           <Field
55             base={2}
56             onValueChange={this._onValueChange}
57             value={this.state.value}
58           />
59         </Label>
60       </div>
61     );
62   }
63 }