]> git.wincent.com - hextrapolate.git/blob - src/App.js
41aedb5eef156bddced99e76b1f09b39195273f9
[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 Field from './Field.react';
12
13 export default class App extends React.Component {
14   constructor(props) {
15     super(props);
16     this.state = {
17       value: '0',
18     };
19   }
20
21   _onValueChange = (value: string) => {
22     this.setState({value});
23   }
24
25   render() {
26     return (
27       <div>
28         <h1>Hextrapolate</h1>
29         <label>
30           Hexadecimal
31           <Field
32             base={16}
33             onValueChange={this._onValueChange}
34             value={this.state.value}
35           />
36         </label>
37         <label>
38           Decimal
39           <Field
40             onValueChange={this._onValueChange}
41             value={this.state.value}
42           />
43         </label>
44         <label>
45           Octal
46           <Field
47             base={8}
48             onValueChange={this._onValueChange}
49             value={this.state.value}
50           />
51         </label>
52         <label>
53           Binary
54           <Field
55             base={2}
56             onValueChange={this._onValueChange}
57             value={this.state.value}
58           />
59         </label>
60       </div>
61     );
62   }
63 }