diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..28566e83b 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,13 +3,16 @@ - Title here + "Quote generator app" + -

hello there

-

-

+

Hello there

+
+

Quote goes here...

+

Author goes here...

+
diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..407f70123 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -16,9 +16,15 @@ // pickFromArray(['a','b','c','d']) // maybe returns 'c' // You don't need to change this function -function pickFromArray(choices) { - return choices[Math.floor(Math.random() * choices.length)]; -} + + + + + + + + + // A list of quotes you can use in your app. // DO NOT modify this array, otherwise the tests may break! @@ -489,5 +495,24 @@ const quotes = [ author: "Zig Ziglar", }, ]; +function pickFromArray(choices) { + return choices[Math.floor(Math.random() * choices.length)]; +} +function displayRandomquote(){ +const randomQuote = pickFromArray(quotes); +document.getElementById("quote").textContent = randomQuote.quote; +document.getElementById("author").textContent = randomQuote.author; +} + +displayRandomquote(); + + +document.getElementById("new-quote").addEventListener("click", () => { + displayRandomquote(); +}); // call pickFromArray with the quotes array to check you get a random quote +/*My First step to generate a quote +const randomQuote = pickFromArray(quotes); +document.getElementById("quote").textContent = randomQuote.quote; +document.getElementById("author").textContent = randomQuote.author;*/ diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2..1a29e2ece 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,47 @@ /** Write your CSS in here **/ + + body { + font-family: sans-serif; + text-align: center; + padding: 40px; + background-color: #f0f0f0; +} + +h1 { + margin-bottom: 30px; + color: #34063c; +} + +.quote-box { + background-color: rgb(139, 191, 193); + border-radius: 10px; + padding: 30px; + margin: 0 auto 20px; + max-width: 500px; + box-shadow: 0 4px 8px rgba(0,0,0,0.1); +} + +#quote { + font-size: 1.5rem; + font-style: italic; + margin-bottom: 20px; +} + +#author { + font-weight: bold; + color: #260559; +} + +#new-quote { + padding: 10px 20px; + font-size: 1rem; + background-color: #00cc66; + color: white; + border: none; + border-radius: 5px; + cursor: pointer; +} + +#new-quote:hover { + background-color: #005fa3; +} \ No newline at end of file