Skip to content

Commit 7cdad93

Browse files
committed
Changes done accordingly
1 parent 7f050d7 commit 7cdad93

File tree

4 files changed

+61
-60
lines changed

4 files changed

+61
-60
lines changed

Quote Generator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Description
44
The Random Quote Generator randomly displays a quote when a button is clicked by user.
55

6-
## Skills
6+
## Stacks Used
77
* JavaScript Async & Await
88
* API
99

Quote Generator/index.html

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8">
5-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<title>Quote Generator</title>
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Quote Generator</title>
88

9-
<!-- google fonts -->
10-
<link rel="preconnect" href="https://fonts.googleapis.com">
11-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
12-
<link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@700&family=Lobster+Two:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
9+
<!-- google fonts -->
10+
<link rel="preconnect" href="https://fonts.googleapis.com" />
11+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
12+
<link
13+
href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@700&family=Lobster+Two:ital,wght@0,400;0,700;1,400;1,700&display=swap"
14+
rel="stylesheet"
15+
/>
1316

14-
<!-- font awesome cdn -->
15-
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.3/css/all.css" integrity="sha384-SZXxX4whJ79/gErwcOYf+zWLeJdY/qpuqC4cAa9rOGUstPomtqpuNWT9wdPEn2fk" crossorigin="anonymous">
17+
<!-- font awesome cdn -->
18+
<link
19+
rel="stylesheet"
20+
href="https://use.fontawesome.com/releases/v5.15.3/css/all.css"
21+
integrity="sha384-SZXxX4whJ79/gErwcOYf+zWLeJdY/qpuqC4cAa9rOGUstPomtqpuNWT9wdPEn2fk"
22+
crossorigin="anonymous"
23+
/>
1624

17-
<link rel="stylesheet" href="style.css">
18-
</head>
19-
<body>
20-
<div>
21-
<h1>Quote Generator</h1>
22-
<div class="container">
23-
<i class="fas fa-quote-left"></i>
24-
<div id="quotes">
25-
Everything in life is luck.
26-
</div>
27-
<hr>
28-
<div id="author">
29-
By Donald Trump
30-
</div>
31-
<button onclick="getQuotes()">New Quotes</button>
32-
33-
</div>
34-
35-
</div>
36-
25+
<link rel="stylesheet" href="style.css" />
26+
</head>
27+
<body>
28+
<div>
29+
<h1>Quote Generator</h1>
30+
<div class="container">
31+
<i class="fas fa-quote-left"></i>
32+
<div id="quotes">Everything in life is luck.</div>
33+
<hr />
34+
<div id="author">By Donald Trump</div>
35+
<button onclick="getQuotes()">New Quotes</button>
36+
</div>
37+
</div>
38+
39+
<script src="script.js"></script>
40+
</body>
41+
</html>
3742

38-
<script src="script.js">
39-
40-
</script>
41-
</body>
42-
</html>

Quote Generator/script.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11

2-
const quotes= document.getElementById('quotes');
2+
const quotes = document.getElementById('quotes');
33
const author = document.getElementById('author');
4-
let jsonData = " ";
5-
let quoteData = " ";
4+
let jsonData = " ";
5+
let quoteData = " ";
66

7-
const randomNo = ()=>{
8-
let randNum = Math.floor(Math.random() *1680);
9-
// console.log(randNum);
10-
quoteData = jsonData[randNum];
11-
quotes.innerText = `${quoteData.text}`;
12-
// author.innerText = `${quoteData.author}`;
7+
const randomNo = () => {
8+
let randNum = Math.floor(Math.random() * 1680);
9+
// console.log(randNum);
10+
quoteData = jsonData[randNum];
11+
quotes.innerText = `${quoteData.text}`;
12+
// author.innerText = `${quoteData.author}`;
1313

14-
quoteData.author == null
15-
?(author.innerText = "By unKnown")
16-
:(author.innerText =`By ${quoteData.author}`);
14+
quoteData.author == null ?
15+
(author.innerText = "By unKnown") :
16+
(author.innerText = `By ${quoteData.author}`);
1717

1818
}
19-
const getQuotes = async()=>{
20-
const api = "https://type.fit/api/quotes";
21-
try {
22-
let data = await fetch(api);
23-
jsonData = await data.json();
24-
// console.log(jsonData[0]);
25-
randomNo();
26-
}catch(error){
27-
console.log(error.message);
28-
}
19+
const getQuotes = async () => {
20+
const api = "https://type.fit/api/quotes";
21+
try {
22+
let data = await fetch(api);
23+
jsonData = await data.json();
24+
// console.log(jsonData[0]);
25+
randomNo();
26+
} catch (error) {
27+
console.log(error.message);
28+
}
2929

3030
}
3131

Quote Generator/style.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,5 @@ button {
9696
height: 700px;
9797
width: 90%;
9898
}
99-
}
99+
}
100+

0 commit comments

Comments
 (0)