Skip to content

Commit 1f8d1d1

Browse files
committed
implement quote generator
1 parent 96d077b commit 1f8d1d1

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

Sprint-3/quote-generator/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
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" />
6-
<title>Title here</title>
6+
<title>Quote generator</title>
77
<script defer src="quotes.js"></script>
8+
<link rel="stylesheet" href="style.css" />
89
</head>
910
<body>
1011
<h1>hello there</h1>

Sprint-3/quote-generator/quotes.js

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

493493
// call pickFromArray with the quotes array to check you get a random quote
494+
495+
const quoteText = document.getElementById("quote");
496+
const authorText = document.getElementById("author");
497+
498+
const newQuoteBtn = document.getElementById("new-quote");
499+
500+
newQuoteBtn.addEventListener("click", () => {
501+
const selectedQuote = pickFromArray(quotes);
502+
quoteText.textContent = selectedQuote.quote;
503+
authorText.textContent = `-- ${selectedQuote.author}`;
504+
});

Sprint-3/quote-generator/style.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
/** Write your CSS in here **/
2+
#author {
3+
font-style: italic;
4+
}

0 commit comments

Comments
 (0)