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

hello there

-

-

- +
+
+

+
+

+ +
+
+
diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..3e1d27246 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -1,3 +1,7 @@ +const quoteEl = document.getElementById("quote"); +const authorEl = document.getElementById("author"); +const newQuoteBtn = document.getElementById("new-quote"); + // DO NOT EDIT BELOW HERE // pickFromArray is a function which will return one item, at @@ -491,3 +495,16 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote +const pickRandomQuote = () => { + const quoteIndex = Math.floor(Math.random() * quotes.length); + return quotes[quoteIndex]; +}; + +const displayRandomQuote = () => { + const { quote, author } = pickRandomQuote(); + quoteEl.textContent = `"${quote}`; + authorEl.textContent = `- ${author}`; +}; +displayRandomQuote(); + +newQuoteBtn.addEventListener("click", displayRandomQuote); diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2..9ffc1778c 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,49 @@ -/** Write your CSS in here **/ +:root { + margin: 0; +} + +main { + display: flex; + justify-content: center; + align-items: center; + position: fixed; + inset: 0; + background-color: #ffa500; + color: #ffa500; +} +section { + width: 60%; + height: 60%; + background-color: #ffffff; + display: flex; + flex-direction: column; + align-items: center; + padding: 2rem; +} + +.quote { + max-width: 100%; + font-size: 2.5rem; +} + +section div { + width: 90%; + max-width: 90%; + + display: flex; + flex-direction: column; + align-items: flex-end; +} + +.author { + font-size: 1.5rem; + font-weight: 300; +} + +button { + border: 0; + font-size: 1.5rem; + color: #ffffff; + background-color: #ffa500; + padding: 1rem; +}