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