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

hello there

-

-

- +
+

Quote Generator

+ +

+

+ + +
diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..83d59d58b 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -491,3 +491,20 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote + +const quoteElement = document.querySelector("#quote"); +const authorElement = document.querySelector("#author"); +const buttonElement = document.querySelector("#new-quote"); + +function showRandomQuote() { + const randomQuote = pickFromArray(quotes); + + quoteElement.textContent = randomQuote.quote; + authorElement.textContent = "— " + randomQuote.author; +} + +// show a quote when the page loads +showRandomQuote(); + +// show a new quote when button is clicked +buttonElement.addEventListener("click", showRandomQuote); \ No newline at end of file diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2..8ebd4309e 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,35 @@ /** Write your CSS in here **/ +body { + background-color: orange; + font-family: Arial, sans-serif; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; +} + +main { + background: white; + padding: 40px; + max-width: 600px; + text-align: center; +} + +#quote { + font-size: 28px; + font-weight: 500; + margin-bottom: 20px; +} + +#author { + margin-bottom: 20px; + font-style: italic; +} + +button { + background-color: orange; + color: white; + border: none; + padding: 10px 20px; + cursor: pointer; +} \ No newline at end of file