Skip to content

Commit

Permalink
Merge pull request #2 from Micky373/react_components
Browse files Browse the repository at this point in the history
Finalize the component branch
  • Loading branch information
Micky373 committed Mar 23, 2022
2 parents 441ff4a + 1f441d4 commit 9f6d502
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 136 deletions.
10 changes: 10 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": ["stylelint-config-standard"],
"plugins": ["stylelint-scss", "stylelint-csstree-validator"],
"rules": {
"at-rule-no-unknown": null,
"scss/at-rule-no-unknown": true,
"csstree/validator": true
},
"ignoreFiles": ["build/**", "dist/**", "**/reset*.css", "**/bootstrap*.css", "**/*.js", "**/*.jsx"]
}
25 changes: 1 addition & 24 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,11 @@
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>
<title>Math Magician 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.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
57 changes: 32 additions & 25 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,39 +1,46 @@
.App {
text-align: center;
}

.App-logo {
height: 40vmin;
pointer-events: none;
body {
display: flex;
align-items: center;
justify-content: center;
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
button {
border: 1px solid #dadada;
font-size: 2rem;
padding: 1rem;
}

.App-header {
background-color: #282c34;
min-height: 100vh;
.calculator_container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
align-items: center;
margin-top: 25%;
}

.display {
align-self: flex-end;
background-color: #6b705c;
width: 100%;
height: 4rem;
}

h1 {
margin: 0 0 0 80%;
padding: 1rem;
color: white;
}

.App-link {
color: #61dafb;
.button_container {
display: grid;
grid-template-columns: repeat(4, 1fr);
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
.item0 {
grid-column-start: 1;
grid-column-end: 3;
}

to {
transform: rotate(360deg);
}
.operator {
background-color: #e85d04;
}
39 changes: 15 additions & 24 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
import logo from './logo.svg';
import React from 'react';
import Calculator from './components/calculator';
import './App.css';

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 {
constructor(props) {
super(props);
this.state = {};
}

render() {
return (
<div className="App">
<Calculator />
</div>
);
}
}

export default App;
8 changes: 0 additions & 8 deletions src/App.test.js

This file was deleted.

41 changes: 41 additions & 0 deletions src/components/calculator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react';

class Calculator extends React.Component {
constructor(props) {
super(props);
this.state = {};
}

render() {
return (
<div className="calculator_container">
<div className="display">
<h1>0</h1>
</div>
<div className="button_container">
<button type="button" className="button">AC</button>
<button type="button" className="button">+/-</button>
<button type="button" className="button">%</button>
<button type="button" className="button operator">/</button>
<button type="button" className="button">7</button>
<button type="button" className="button">8</button>
<button type="button" className="button">9</button>
<button type="button" className="button operator">x</button>
<button type="button" className="button">4</button>
<button type="button" className="button">5</button>
<button type="button" className="button">6</button>
<button type="button" className="button operator">-</button>
<button type="button" className="button">1</button>
<button type="button" className="button">2</button>
<button type="button" className="button">3</button>
<button type="button" className="button operator">+</button>
<button type="button" className="button item0">0</button>
<button type="button" className="button">.</button>
<button type="button" className="button operator">=</button>
</div>
</div>
);
}
}

export default Calculator;
27 changes: 0 additions & 27 deletions src/index.css

This file was deleted.

7 changes: 0 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root'),
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
1 change: 0 additions & 1 deletion src/logo.svg

This file was deleted.

15 changes: 0 additions & 15 deletions src/reportWebVitals.js

This file was deleted.

5 changes: 0 additions & 5 deletions src/setupTests.js

This file was deleted.

0 comments on commit 9f6d502

Please sign in to comment.