Skip to content

Commit

Permalink
Done
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepkapadia committed Jun 10, 2020
1 parent 6309a7f commit 4f385e3
Show file tree
Hide file tree
Showing 12 changed files with 172 additions and 233 deletions.
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.19.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
Expand Down
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
name="description"
content="Web site created using create-react-app"
/>
<link href="https://fonts.googleapis.com/css2?family=Spartan:wght@500&display=swap" rel="stylesheet">
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
Expand Down
120 changes: 97 additions & 23 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,38 +1,112 @@
.App {
text-align: center;
#root, html , body {
margin: 0;
padding: 0;
height: 100vh;
box-sizing: border-box;
font-family: 'Spartan', sans-serif;
}

.App-logo {
height: 40vmin;
pointer-events: none;
.app {
height: 100%;
background: linear-gradient(rgba(0, 0 , 0, 0.3 ),rgba(0, 0 , 0, 0.3 )), url('./images/bg.jpg');
background-size: cover;
background-position: center;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
.card {
background-color: whitesmoke;
width: 40%;
height: 20%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
border-radius: 25px;
padding: 2%;
}

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

.App-link {
color: #61dafb;
@media only screen and (max-width: 600px) {
.card {
width: 80%;
height: 30%;
}
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
.button {
position: relative;
outline: none;
text-decoration: none;
border-radius: 50px;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
text-transform: uppercase;
height: 200px;
width: 210px;
opacity: 1;
background-color: #ffffff;
border: 1px solid rgba(22, 76, 167, 0.6);
}

.button span {
color: #164ca7;
font-size: 12px;
font-weight: 500;
letter-spacing: 0.7px;
}

.button:hover {
animation: rotate 0.7s ease-in-out both;
}

.button:hover span {
animation: storm 0.7s ease-in-out both;
animation-delay: 0.06s;
}

@keyframes rotate {
0% {
transform: rotate(0deg) translate3d(0, 0, 0);
}
25% {
transform: rotate(3deg) translate3d(0, 0, 0);
}
to {
transform: rotate(360deg);
50% {
transform: rotate(-3deg) translate3d(0, 0, 0);
}
75% {
transform: rotate(1deg) translate3d(0, 0, 0);
}
100% {
transform: rotate(0deg) translate3d(0, 0, 0);
}
}

@keyframes storm {
0% {
transform: translate3d(0, 0, 0) translateZ(0);
}
25% {
transform: translate3d(4px, 0, 0) translateZ(0);
}
50% {
transform: translate3d(-3px, 0, 0) translateZ(0);
}
75% {
transform: translate3d(2px, 0, 0) translateZ(0);
}
100% {
transform: translate3d(0, 0, 0) translateZ(0);
}
}
63 changes: 40 additions & 23 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,43 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
import React, { Component } from 'react'
import Axios from 'axios'
import '../src/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 Component {

state = {
advice: ''
};
componentDidMount() {
this.FetchAdvice()
}

FetchAdvice = () => {
Axios.get('https://api.adviceslip.com/advice')
.then((response) => {

const { advice } = response.data.slip;
this.setState({advice});

})
.catch((error) => {
console.log(error);

})
}

render() {
const {advice} = this.state
return (
<div className="app">
<div className="card">
<h1 className="heading">{advice}</h1>
<button className="button" onClick={this.FetchAdvice}>
<span>GIVE ME ADVICE</span>
</button>
</div>
</div>
)
}
}

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

This file was deleted.

Binary file added src/images/bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 0 additions & 13 deletions src/index.css

This file was deleted.

14 changes: 2 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';

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


// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
7 changes: 0 additions & 7 deletions src/logo.svg

This file was deleted.

Loading

0 comments on commit 4f385e3

Please sign in to comment.