Skip to content

Commit b0c1d53

Browse files
committed
Work on quote-generator
1 parent de6889c commit b0c1d53

3 files changed

Lines changed: 23 additions & 3 deletions

File tree

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Title here</title>
7+
<link rel="stylesheet" type="text/css" href="style.css" />
78
<script defer src="quotes.js"></script>
89
</head>
910
<body>
1011
<h1>hello there</h1>
11-
<p id="quote"></p>
12+
<blockquote id="quote"></blockquote>
1213
<p id="author"></p>
13-
<button type="button" id="new-quote">New quote</button>
14+
<button type="button" id="new-quote" onclick="generate()">New quote</button>
1415
</body>
1516
</html>

‎Sprint-3/quote-generator/quotes.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,3 +491,12 @@ const quotes = [
491491
];
492492

493493
// call pickFromArray with the quotes array to check you get a random quote
494+
495+
function generate() {
496+
const pick = pickFromArray(quotes);
497+
498+
document.getElementById("quote").innerHTML = `"${pick.quote}"`;
499+
document.getElementById("author").innerHTML = `By ${pick.author}`;
500+
}
501+
502+
generate();

‎Sprint-3/quote-generator/style.css‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
/** Write your CSS in here **/
2+
3+
#author {
4+
font-size: 25px;
5+
}
6+
7+
#quote {
8+
font-size: 30px;
9+
font-style: italic;
10+
font-weight: bold;
11+
}

0 commit comments

Comments
 (0)