diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..9c03e4c8b 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,13 +3,17 @@ - Title here + Quote generator app + -

hello there

+

+ + +
- + \ No newline at end of file diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..ab48634ea 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -491,3 +491,29 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote +const quote = document.querySelector("#quote"); +const author = document.querySelector("#author"); +const quoteButton = document.querySelector("#new-quote"); +const autoQuoteCheckBox = document.querySelector("#auto-quote"); +const autoQuoteLabel = document.querySelector("#auto-quote-label"); +let interval; +function generateQuote() { + const randomQuote = pickFromArray(quotes); + quote.innerText = randomQuote.quote; + author.innerText = randomQuote.author; +} +quoteButton.addEventListener("click", () => { + generateQuote(); +}); + +generateQuote(); + +function autoQuote() { + if (autoQuoteCheckBox.checked === true) { + interval = setInterval(generateQuote, 60000); + autoQuoteLabel.innerText = "auto play on"; + } else { + clearInterval(interval); + autoQuoteLabel.innerText = "auto play off"; + } +} diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2..5c8c50da5 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,38 @@ /** Write your CSS in here **/ + +body{ + background-color: rgba(255, 183, 0, 0.912); +} + +#centre { + background-color: white; + margin: 100px; + padding: 100px; + align-content: center; +} + +p{ + color: rgba(255, 183, 0, 0.912); + font-size: xx-large; +} +#author{ + display: flex; + flex-direction: column; + align-items: flex-end; +} +h1 { + text-align: center; +} +#new-quote{ + display: block; + margin-left: auto; + margin-right: 0; + padding: 10pt; + background-color: rgba(255, 183, 0, 0.912); + border: 0cap; + color: white; + font-size: large; +} +#auto-quote{ + font-size: large; +} \ No newline at end of file