Skip to content

Commit

Permalink
spinner done
Browse files Browse the repository at this point in the history
  • Loading branch information
yung-coder committed Jul 27, 2022
1 parent 593b8f0 commit 3e9c1cb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
35 changes: 19 additions & 16 deletions src/plays/dev-jokes/DevJokes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import PlayHeader from "common/playlists/PlayHeader";
import "./devJokes.css";
import axios from "axios";
import { useEffect, useState } from "react";
import Spinner from './Spinner'
import Spinner from "./Spinner";
function DevJokes(props) {
const [joke, setjoke] = useState([]);
const [spinner,setspinner]=useState(false);
const [spinner, setspinner] = useState(false);
const fetch = () => {
setspinner(true);
axios
Expand All @@ -24,21 +24,24 @@ function DevJokes(props) {
<PlayHeader play={props} />
<div className="maincontanier">
<div className="jokecontanier">
{ spinner ?
<Spinner/> :
<div>
{joke.map((value) => {
return (
<div key={value}>
<h1>{value.question}</h1>
<p>{value.punchline}</p>
</div>
);
})}
{spinner ? (
<Spinner />
) : (
<div>
{joke.map((value) => {
return (
<div key={value}>
<h1>{value.question}</h1>
<p>{value.punchline}</p>
</div>
);
})}
</div>
)}
</div>
}
</div>
<button onClick={fetch} className="dev-jokes-btn">Next joke</button>
<button onClick={fetch} className="dev-jokes-btn">
Next joke
</button>
</div>
</div>
</>
Expand Down
6 changes: 3 additions & 3 deletions src/plays/dev-jokes/spinner.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
}
}
.loading-spinner {
width: 50px;
height: 50px;
border: 10px solid #f3f3f3; /* Light grey */
width: 40px;
height: 40px;
border: 10px solid #fefefe; /* Light grey */
border-top: 10px solid #383636; /* Black */
border-radius: 50%;
animation: spinner 1.5s linear infinite;
Expand Down

0 comments on commit 3e9c1cb

Please sign in to comment.