diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..989acb61c 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -1,15 +1,24 @@ - + - Title here + Quote generator app + -

hello there

-

-

- +
+
+

Daily Motivation For You

+

+

+ + +
+
diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..361f00387 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -491,3 +491,26 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote +function showRandomQuote() { + const randomQuote = pickFromArray(quotes); + const quoteElement = document.querySelector("#quote"); + const authorElement = document.querySelector("#author"); + + quoteElement.textContent = randomQuote.quote; + authorElement.textContent = randomQuote.author; +} +showRandomQuote(); +const button = document.querySelector("#new-quote"); +button.addEventListener("click", showRandomQuote); + +const autoplayQuote = document.querySelector("#autoplay-quote"); +let autoplayInterval = null; + +autoplayQuote.addEventListener("change", function () { + if (autoplayQuote.checked) { + autoplayInterval = setInterval(showRandomQuote, 5000); + } else { + clearInterval(autoplayInterval); + autoplayInterval = null; + } +}); diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2..d8be23155 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,68 @@ -/** Write your CSS in here **/ +body { + margin: 0; + padding: 0; + font-family: + system-ui, + -apple-system, + BlinkMacSystemFont, + "Segoe UI", + sans-serif; + background-color: #5e77c2; + display: flex; + justify-content: center; + align-items: center; + min-height: 100vh; +} +.app { + display: flex; + justify-content: center; + align-items: center; +} +.quote-card { + background-color: #ffffff; + padding: 32px; + border-radius: 30px; + width: 900px; + min-height: 280px; + max-width: 800px; + text-align: center; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); + position: relative; + display: flex; + flex-direction: column; +} +#quote { + color: #043d52; + font-size: 20px; + margin-bottom: 1px; +} +#author { + color: #555555; + font-size: 17px; + font-style: italic; + position: absolute; + bottom: 90px; + right: 60px; +} +#new-quote { + background-color: #5e77c2; + color: #ffffff; + border: none; + padding: 10px 22px; + border-radius: 4px; + font-size: 16px; + cursor: pointer; + position: absolute; + bottom: 40px; + right: 50px; +} + +#new-quote:hover { + background-color: #3f3642; +} +.quote-card label { + position: absolute; + bottom: 40px; + left: 50px; + font-size: 16px; +}