From 0cc51cd4e04f0bb0d0a81bf75ffbb69c8ee691fa Mon Sep 17 00:00:00 2001 From: MacDonald91 Date: Tue, 17 Mar 2026 22:28:19 +0000 Subject: [PATCH 1/2] complete build of quote generator app --- Sprint-3/quote-generator/index.html | 3 ++- Sprint-3/quote-generator/quotes.js | 15 ++++++++++++ Sprint-3/quote-generator/style.css | 36 +++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..9a65b11ee 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,7 +3,8 @@ - Title here + Quote generator app + diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..1c75d6e49 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -491,3 +491,18 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote + +function displayRandomQuote() { + const randomQuote = pickFromArray(quotes); + + document.getElementById("quote").textContent = randomQuote.quote; + document.getElementById("author").textContent = randomQuote.author; +} + +// run when page loads2 +displayRandomQuote(); + +// button click +document + .getElementById("new-quote") + .addEventListener("click", displayRandomQuote); diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2..a3984bd5a 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,37 @@ /** Write your CSS in here **/ +body { + font-family: Arial, sans-serif; + background-color: #f4f4f4; + text-align: center; + padding: 50px; +} + +h1 { + color: #333; +} + +#quote { + font-size: 1.5rem; + margin: 20px 0; + color: #222; +} + +#author { + font-size: 1.2rem; + color: #666; + margin-bottom: 30px; +} + +button { + padding: 10px 20px; + font-size: 1rem; + background-color: #007BFF; + color: white; + border: none; + border-radius: 5px; + cursor: pointer; +} + +button:hover { + background-color: #0056b3; +} \ No newline at end of file From 903eebe57bf7f7d6f3479a703e4bf96deacdf59c Mon Sep 17 00:00:00 2001 From: MacDonald91 Date: Wed, 15 Apr 2026 18:29:26 +0100 Subject: [PATCH 2/2] fix: moved run load logic into a setup --- Sprint-3/quote-generator/quotes.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 1c75d6e49..d2ac1d67c 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -498,11 +498,12 @@ function displayRandomQuote() { document.getElementById("quote").textContent = randomQuote.quote; document.getElementById("author").textContent = randomQuote.author; } +function setup() { + displayRandomQuote(); -// run when page loads2 -displayRandomQuote(); - -// button click -document + document .getElementById("new-quote") .addEventListener("click", displayRandomQuote); +} + +window.addEventListener("load", setup);