diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcfb..1313a21e97 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -1,15 +1,26 @@ - + - Title here + Quote generator app + -

hello there

-

-

- +
+

Quote Generator

+

+

+ + +
+ +

auto-play:OFF

+
+
diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b722..aaf09e8534 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -491,3 +491,41 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote +const quoteElement = document.getElementById("quote"); +const authorElement = document.getElementById("author"); +const newQuoteButton = document.getElementById("new-quote"); + +function showRandomQuote() { + const randomQuote = pickFromArray(quotes); + quoteElement.textContent = randomQuote.quote; + authorElement.textContent = "- " + randomQuote.author; +} + +showRandomQuote(); + +newQuoteButton.addEventListener("click", showRandomQuote); + +const AUTO_PLAY_DELAY = 5000; +const autoPlayToggle = document.getElementById("auto-play-toggle"); +const autoPlayStatus = document.getElementById("auto-play-status"); + +let autoPlayTimer = null; + +function startAutoPlay() { + autoPlayTimer = setInterval(showRandomQuote, AUTO_PLAY_DELAY); + autoPlayStatus.textContent = "auto-play:ON"; +} + +function stopAutoPlay() { + clearInterval(autoPlayTimer); + autoPlayTimer = null; + autoPlayStatus.textContent = "auto-play:OFF"; +} + +autoPlayToggle.addEventListener("change", function () { + if (autoPlayToggle.checked) { + startAutoPlay(); + } else { + stopAutoPlay(); + } +}); diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2f..6ae00e8163 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,61 @@ -/** Write your CSS in here **/ +* { + box-sizing: border-box; +} + +body { + margin: 0; + min-height: 100vh; + display: flex; + justify-content: center; + align-items: center; + background: linear-gradient(135deg, #667eea, #764ba2); + font-family: Georgia, "Times New Roman", Times, serif; + padding: 1rem; +} + +.card { + background: #ffffff; + max-width: 600px; + width: 100%; + padding: 2rem; + border-radius: 12px; + box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); + text-align: center; +} + +h1 { + margin-top: 0; + font-size: 1rem; + letter-spacing: 0.15em; + text-transform: uppercase; + color: #888; +} + +#quote { + font-size: 1.5rem; + line-height: 1.5; + font-style: italic; + color: #222; + margin: 1.5rem 0 1rem; +} + +button { + background: #764ba2; + color: #ffffff; + border: none; + padding: 0.75rem 1.75rem; + font-size: 1rem; + border-radius: 999px; + cursor: pointer; + transition: + background 0.2s, + transform 0.1s; +} + +button:hover { + background: #5d3a85; +} + +button:active { + transform: scale(0.96); +}