16 | );
17 | }
18 | }
19 |
20 | ReactDOM.render(, document.querySelector('#calculator'));
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "calculator",
3 | "version": "0.0.0",
4 | "private": true,
5 | "scripts": {
6 | "build": "webpack",
7 | "start": "webpack-dev-server --content-base build"
8 | },
9 | "dependencies": {
10 | "react": "^0.14.6",
11 | "react-dom": "^0.14.6"
12 | },
13 | "devDependencies": {
14 | "babel-core": "^6.4.5",
15 | "babel-loader": "^6.2.1",
16 | "babel-preset-es2015": "^6.3.13",
17 | "babel-preset-react": "^6.3.13",
18 | "css-loader": "^0.23.1",
19 | "eslint-plugin-react": "^3.16.1",
20 | "http-server": "^0.8.5",
21 | "jsx-loader": "^0.13.2",
22 | "style-loader": "^0.13.0",
23 | "stylus-loader": "^1.5.1",
24 | "webpack": "^1.12.12",
25 | "webpack-dev-server": "^1.14.1"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | var webpack = require('webpack')
2 | , path = require('path');
3 |
4 | module.exports = {
5 | context : path.join(__dirname, './'),
6 | entry: './src/Calculator.jsx',
7 | output: {
8 | path: path.join(__dirname, 'public'),
9 | filename: 'bundle.min.js'
10 | },
11 | plugins: [
12 | new webpack.optimize.UglifyJsPlugin({minimize: true})
13 | ],
14 | resolve: {
15 | extensions: ['', '.js', '.jsx','.styl']
16 | },
17 | module: {
18 | loaders: [
19 | {
20 | test: /\.styl$/,
21 | loaders: ['style-loader','css-loader','stylus-loader'],
22 | include: path.join(__dirname, 'src/styl')
23 | },
24 | {
25 | test: /\.jsx?$/,
26 | loader: 'babel-loader',
27 | exclude: /node_modules/,
28 | query: {
29 | presets: ['es2015', 'react']
30 | },
31 | include: path.join(__dirname, 'src')
32 | }
33 | ]
34 | }
35 | };
36 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # React Calculator
2 | [](https://github.com/guuibayer/react-calculator/blob/develop/LICENSE.md)
3 | [](https://david-dm.org/guuibayer/react-calculator#info=devDependencies)
4 |
5 | > :heavy_plus_sign: Example from a calculator in react
6 |
7 | ## Demo
8 | In construction!
9 |
10 | ## Notes
11 | You want to contribute? open a issue [here](https://github.com/guuibayer/react-calculator/issues/new), this component use [Airbnb style guide](https://github.com/airbnb/javascript/tree/master/react), please follow.
12 |
13 | ## How use
14 | ```bash
15 | # First, in your terminal, install dependencies from app
16 | $ npm install
17 |
18 | # Run the command below to build the app,
19 | $ npm run build
20 |
21 | # To run in the browser and watch changes, run command below and open localhost
22 | $ npm start
23 | ```
24 |
25 | ## License
26 | [MIT Licence](https://github.com/guuibayer/react-calculator/blob/develop/LICENSE.md)
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | # License
2 | ==============
3 | The MIT License (MIT)
4 |
5 | Copyright (c) 2016 Guilherme Bayer
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to React Calculator
2 |
3 | You want to help? You rock! Now, take a moment to be sure your contributions make sense to everyone else.
4 |
5 | ## Reporting Issues
6 |
7 | Found a problem? Want a new feature?
8 |
9 | - See if your issue or idea has [already been reported].
10 | - Provide a [reduced test case] or a [live example].
11 |
12 | Remember, a bug is a _demonstrable problem_ caused by _our_ code.
13 |
14 | ## Submitting Pull Requests
15 |
16 | Pull requests are the greatest contributions, so be sure they are focused in scope, and do avoid unrelated commits.
17 |
18 | 1. To begin, [fork this project], clone your fork, and add our upstream.
19 | ```bash
20 | # Clone your fork of the repo into the current directory
21 | git clone https://github.com//react-calculator
22 |
23 | # Navigate to the newly cloned directory
24 | cd react-calculator
25 |
26 | # Assign the original repo to a remote called "upstream"
27 | git remote add upstream https://github.com/guuibayer/react-calculator
28 |
29 | # Install the tools necessary for development
30 | npm install
31 |
32 | # To development, run the project and go to localhost:8080 in you browser
33 | npm start
34 |
35 | # To build project
36 | npm run build
37 | ```
38 |
39 | 2. Create a branch for your feature or fix:
40 | ```bash
41 | # Move into a new branch for a feature
42 | git checkout -b feature/thing
43 | ```
44 | ```bash
45 | # Move into a new branch for a fix
46 | git checkout -b fix/something
47 | ```
48 |
49 | 3. Push your branch up to your fork:
50 | ```bash
51 | # Push a feature branch
52 | git push origin feature/thing
53 | ```
54 | ```bash
55 | # Push a fix branch
56 | git push origin fix/something
57 | ```
58 |
59 | 4. Now [open a pull request] with a clear title and description.
60 |
61 | [already been reported]: issues
62 | [fork this project]: fork
63 | [live example]: http://codepen.io/pen
64 | [open a pull request]: https://help.github.com/articles/using-pull-requests/
65 |
--------------------------------------------------------------------------------
/src/components/CalculatorKeys.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | class CalculatorKeys extends React.Component {
4 | render() {
5 | return (
6 |