From b9a0cd2c6a735bd58a1caddfccf086d803d5bda3 Mon Sep 17 00:00:00 2001 From: Rahana Suleiman Date: Tue, 17 Nov 2026 19:30:26 +0000 Subject: [PATCH 1/6] Implement random quote display functionality with button interaction --- Sprint-3/quote-generator/quotes.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b722..141e54da87 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -491,3 +491,19 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote + +const quoteElement = document.querySelector("#quote"); +const authorElement = document.querySelector("#author"); +const newQuoteButton = document.querySelector("#new-quote"); + +function displayRandomQuote() { + const randomQuote = pickFromArray(quotes); + quoteElement.textContent = randomQuote.quote; + authorElement.textContent = randomQuote.author; +} + +// Display an initial random quote when the page loads +displayRandomQuote(); + +// Display a new random quote each time the button is clicked +newQuoteButton.addEventListener("click", displayRandomQuote); From c013b0b316aa9f4e5ef899e847d35ff6fda3a549 Mon Sep 17 00:00:00 2001 From: Rahana Suleiman Date: Fri, 20 Nov 2026 23:59:15 +0000 Subject: [PATCH 2/6] Fix HTML doctype and update page title for quote generator app --- Sprint-3/quote-generator/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcfb..befe8788e2 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -1,9 +1,9 @@ - + - Title here + Quote generator app From e711066a3a8633c5b86e8bcddca8152390ab83b6 Mon Sep 17 00:00:00 2001 From: Rahana Suleiman Date: Sat, 21 Nov 2026 00:11:19 +0000 Subject: [PATCH 3/6] Add missing stylesheet link in index.html --- Sprint-3/quote-generator/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index befe8788e2..4b8da3d6e6 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -5,6 +5,7 @@ Quote generator app +

hello there

From 9f057aada1937b508953d65b3cf9c97784a19132 Mon Sep 17 00:00:00 2001 From: Rahana Suleiman Date: Sat, 21 Nov 2026 00:11:27 +0000 Subject: [PATCH 4/6] Add initial CSS styles for quote generator app --- Sprint-3/quote-generator/style.css | 51 ++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2f..f70b4b24ae 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,52 @@ /** Write your CSS in here **/ +*, +*::before, +*::after { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + max-width: 48rem; + padding: 2rem; + font-family: + system-ui, + -apple-system, + BlinkMacSystemFont, + "Segoe UI", + sans-serif; + background: #ffffff; + color: #111827; + line-height: 1.5; +} + +h1 { + margin-bottom: 1rem; + font-size: 2rem; +} + +#quote { + margin-bottom: 0.75rem; + font-size: 1.2rem; +} + +#author { + margin-bottom: 1.5rem; + color: #4b5563; + font-style: italic; +} + +#new-quote { + padding: 0.55rem 1.1rem; + border: 1px solid #d1d5db; + border-radius: 0.4rem; + background: #888; + color: #111827; + font-size: 0.95rem; + cursor: pointer; +} + +#new-quote:hover { + background: #f3f4f6; +} From 21cd4fde0987fc86c85ec9aba7198b4dd310b6ff Mon Sep 17 00:00:00 2001 From: Rahana Suleiman Date: Sat, 21 Nov 2026 00:11:35 +0000 Subject: [PATCH 5/6] Implement auto-quote feature with interval and reset on button click --- Sprint-3/quote-generator/quotes.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 141e54da87..8f6b19fa32 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -496,14 +496,36 @@ const quoteElement = document.querySelector("#quote"); const authorElement = document.querySelector("#author"); const newQuoteButton = document.querySelector("#new-quote"); +// function displayRandomQuote() { +// const randomQuote = pickFromArray(quotes); +// quoteElement.textContent = randomQuote.quote; +// authorElement.textContent = randomQuote.author; +// } + +const AUTO_INTERVAL_MS = 6000; +let autoQuoteInterval = null; + function displayRandomQuote() { const randomQuote = pickFromArray(quotes); quoteElement.textContent = randomQuote.quote; authorElement.textContent = randomQuote.author; } +function startAutoQuotes(fetchFn) { + if (autoQuoteInterval) { + clearInterval(autoQuoteInterval); + } + autoQuoteInterval = setInterval(() => { + fetchFn(); + }, AUTO_INTERVAL_MS); +} + // Display an initial random quote when the page loads displayRandomQuote(); +startAutoQuotes(displayRandomQuote); -// Display a new random quote each time the button is clicked -newQuoteButton.addEventListener("click", displayRandomQuote); +// Display a new quote on click and reset the auto-timer +newQuoteButton.addEventListener("click", () => { + displayRandomQuote(); + startAutoQuotes(displayRandomQuote); +}); From afbc2a67f11d8278d4f856a7435703aee8f9702a Mon Sep 17 00:00:00 2001 From: Rahana Suleiman Date: Sat, 21 Nov 2026 15:08:19 +0000 Subject: [PATCH 6/6] Update hover background color for new quote button --- Sprint-3/quote-generator/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index f70b4b24ae..38b274816b 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -48,5 +48,5 @@ h1 { } #new-quote:hover { - background: #f3f4f6; + background: #ffffff; }