commit 6e3b57f44767b8a58f742da5207934ccdd65dc66
parent eef41832c917da77b1072fba7d9c6708fdb43b07
Author: therealFIGBERT <figbertwelner@gmail.com>
Date: Fri, 22 Nov 2019 09:44:29 -0800
Create button component, modify calcOut prop types
Diffstat:
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/src/components/calcButton.js b/src/components/calcButton.js
@@ -0,0 +1,20 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import './App.css'
+
+export class CalcButton extends React.Component {
+ render() {
+ return (
+ <div className='calc calc__button'>
+ {this.props.value}
+ </div>
+ );
+ }
+}
+
+CalcButton.propTypes = {
+ value: PropTypes.oneOfType([
+ PropTypes.string,
+ PropTypes.number
+ ]).isRequired
+};
diff --git a/src/components/calcOut.js b/src/components/calcOut.js
@@ -15,6 +15,12 @@ export class CalcOut extends React.Component {
}
CalcOut.propTypes = {
- output: PropTypes.number.isRequired,
- input: PropTypes.number.isRequired
+ output: PropTypes.oneOfType([
+ PropTypes.string,
+ PropTypes.number
+ ]).isRequired,
+ input: PropTypes.oneOfType([
+ PropTypes.string,
+ PropTypes.number
+ ]).isRequired
};
\ No newline at end of file