-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add calculator component and basic styles #3
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Binary file not shown.
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,43 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="theme-color" content="#000000" /> | ||
<meta | ||
name="description" | ||
content="Web site created using create-react-app" | ||
/> | ||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
<!-- | ||
manifest.json provides metadata used when your web app is installed on a | ||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
|
||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>React App</title> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="theme-color" content="#000000" /> | ||
<meta name="description" content="Web site created using create-react-app" /> | ||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
<title>Math Magician</title> | ||
</head> | ||
|
||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
<body> | ||
<div id="root"></div> | ||
</body> | ||
|
||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</body> | ||
</html> | ||
</html> |
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
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,84 @@ | ||
.App { | ||
text-align: center; | ||
*, | ||
*::before, | ||
*::after { | ||
-webkit-box-sizing: border-box; | ||
-moz-box-sizing: border-box; | ||
box-sizing: border-box; | ||
} | ||
|
||
.App-logo { | ||
height: 40vmin; | ||
pointer-events: none; | ||
* { | ||
padding: 0; | ||
margin: 0; | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
.App-logo { | ||
animation: App-logo-spin infinite 20s linear; | ||
} | ||
html { | ||
font-size: 62.5%; | ||
font-size: calc(60% + 0.8vmin); | ||
scroll-behavior: smooth; | ||
} | ||
|
||
.App-header { | ||
background-color: #282c34; | ||
min-height: 100vh; | ||
h1 { | ||
font-size: 2.4rem; | ||
} | ||
|
||
h2 { | ||
font-size: 2rem; | ||
} | ||
|
||
h3 { | ||
font-size: 1.8rem; | ||
} | ||
|
||
h4 { | ||
font-size: 1.4rem; | ||
} | ||
|
||
p { | ||
font-size: 1.2rem; | ||
} | ||
|
||
.calculator-placeholder { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: calc(10px + 2vmin); | ||
color: white; | ||
align-items: center; | ||
margin-top: 20vh; | ||
} | ||
|
||
.calculator { | ||
display: grid; | ||
grid-template-columns: repeat(4, 1fr); | ||
width: 50%; | ||
} | ||
|
||
.calculator :nth-child(18) { | ||
grid-column: span 2; | ||
} | ||
|
||
.App-link { | ||
color: #61dafb; | ||
.calculator :nth-child(5), | ||
.calculator :nth-child(9), | ||
.calculator :nth-child(13), | ||
.calculator :nth-child(17), | ||
.calculator :nth-child(20) { | ||
background-color: orange; | ||
} | ||
|
||
@keyframes App-logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
.calculator :nth-child(5):hover { | ||
background-color: rgb(255, 195, 85); | ||
} | ||
|
||
.input { | ||
grid-column: span 4; | ||
padding: 1rem; | ||
background-color: rgb(180, 180, 180); | ||
text-align: right; | ||
} | ||
|
||
.btn { | ||
padding: 1rem; | ||
border: 1px solid rgb(170, 170, 170); | ||
} | ||
|
||
to { | ||
transform: rotate(360deg); | ||
} | ||
.btn:hover { | ||
background-color: aliceblue; | ||
} |
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,29 +1,15 @@ | ||
import logo from './logo.svg'; | ||
/* eslint-disable react/prefer-stateless-function */ | ||
|
||
import React from 'react'; | ||
import './App.css'; | ||
import Calculator from './components/Calculator'; | ||
|
||
function App() { | ||
return ( | ||
<div className="App"> | ||
<header className="App-header"> | ||
<img src={logo} className="App-logo" alt="logo" /> | ||
<p> | ||
Edit | ||
{' '} | ||
<code>src/App.js</code> | ||
{' '} | ||
and save to reload. | ||
</p> | ||
<a | ||
className="App-link" | ||
href="https://reactjs.org" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Learn React | ||
</a> | ||
</header> | ||
</div> | ||
); | ||
class App extends React.Component { | ||
render() { | ||
return ( | ||
<Calculator /> | ||
); | ||
} | ||
} | ||
|
||
export default App; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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,37 @@ | ||
/* eslint-disable react/prefer-stateless-function */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
import React from 'react'; | ||
|
||
class Calculator extends React.Component { | ||
render() { | ||
return ( | ||
<div id="calculator-placeholder" className="calculator-placeholder"> | ||
<h1>Tito' Calculator</h1> | ||
<div id="calculator" className="calculator"> | ||
<input type="text" name="input" className="btn input" id="input" /> | ||
<input type="button" className="btn" value="AC" /> | ||
<input type="button" className="btn" value="+/-" /> | ||
<input type="button" className="btn" value="%" /> | ||
<input type="button" className="btn operator" value="÷" /> | ||
<input type="button" className="btn" value="7" /> | ||
<input type="button" className="btn" value="8" /> | ||
<input type="button" className="btn" value="9" /> | ||
<input type="button" className="btn operator" value="x" /> | ||
<input type="button" className="btn" value="4" /> | ||
<input type="button" className="btn" value="5" /> | ||
<input type="button" className="btn" value="6" /> | ||
<input type="button" className="btn operator" value="-" /> | ||
<input type="button" className="btn" value="1" /> | ||
<input type="button" className="btn" value="2" /> | ||
<input type="button" className="btn" value="3" /> | ||
<input type="button" className="btn operator" value="+" /> | ||
<input type="button" className="btn" value="0" /> | ||
<input type="button" className="btn" value="." /> | ||
<input type="button" className="btn operator" value="=" /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default Calculator; |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disable because the error the linter rule was telling me to create a purê funcional component, and the requirement asks for another thing.