-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Clean up components * add gitignore * More cleanup * Update styles and add clear and clear all * Add crapio logo * Add big styles * Display results when using a continued expression * Remove DS_Store files * Rename index
- Loading branch information
1 parent
d0f719a
commit 25d2fa1
Showing
12 changed files
with
6,227 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
import React from 'react'; | ||
|
||
class Button extends React.Component { | ||
import React, { Component } from 'react'; | ||
|
||
class Button extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.handleButtonClick = this.handleButtonClick.bind(this); | ||
} | ||
|
||
handleButtonClick(e, button) { | ||
e.preventDefault(); | ||
this.props.buttonClick(this.props.button); | ||
} | ||
|
||
render() { | ||
const { button } = this.props; | ||
return ( | ||
<div className="buttonContainer"> | ||
|
||
<button className="button" | ||
onClick={e => this.handleButtonClick(e, this.props.button)}> | ||
{this.props.button} | ||
<button | ||
className="button" | ||
onClick={this.handleButtonClick} | ||
tabIndex={0} | ||
> | ||
{button} | ||
</button> | ||
|
||
</div> | ||
); | ||
} | ||
|
||
handleButtonClick(e, button) { | ||
e.preventDefault(); | ||
this.props.buttonClick(button); | ||
} | ||
|
||
} | ||
|
||
export default Button; | ||
export default Button; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,16 @@ | ||
import React from 'react'; | ||
|
||
import Button from './Button'; | ||
|
||
class ButtonRow extends React.Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
render() { | ||
|
||
return ( | ||
<div className="buttonRow"> | ||
|
||
{ this.props.buttons.map(button => { | ||
return ( | ||
<Button | ||
key={'button' + button} | ||
button={button} | ||
buttonClick={(button) => this.props.buttonClick(button)} | ||
/> | ||
); | ||
})} | ||
|
||
</div> | ||
); | ||
} | ||
|
||
} | ||
|
||
export default ButtonRow; | ||
const ButtonRow = ({ buttonClick, buttons }) => ( | ||
<div className="buttonRow"> | ||
{buttons.map(button => ( | ||
<Button | ||
key={'button-' + button} | ||
button={button} | ||
buttonClick={buttonClick} | ||
/> | ||
))} | ||
</div> | ||
); | ||
|
||
export default ButtonRow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,17 @@ | ||
import React from 'react'; | ||
|
||
import ButtonRow from './ButtonRow'; | ||
import * as constants from '../constants'; | ||
|
||
class ButtonsContainer extends React.Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
buttons: constants.BUTTON_MAP | ||
}; | ||
} | ||
|
||
render() { | ||
|
||
return ( | ||
<div className="buttonContainer"> | ||
|
||
{ this.state.buttons.map((row, i) => { | ||
return ( | ||
<div key={'row' + i}> | ||
|
||
<ButtonRow | ||
buttons={row} | ||
buttonClick={(button) => this.props.buttonClick(button)} | ||
/> | ||
|
||
</div> | ||
); | ||
})} | ||
|
||
import { BUTTON_MAP } from '../constants'; | ||
|
||
const ButtonsContainer = ({ buttonClick, buttons }) => ( | ||
<div className="buttonContainer" role="group" aria-label="calculator buttons"> | ||
{BUTTON_MAP.map((row, i) => ( | ||
<div key={'row' + i}> | ||
<ButtonRow | ||
buttons={row} | ||
buttonClick={buttonClick} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
} | ||
|
||
export default ButtonsContainer; | ||
))} | ||
</div> | ||
); | ||
export default ButtonsContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.