diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..696054c35 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

-

-

- +

Quote Generator

+
+

+

+ +
+ diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..3a6f2043d 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -1,3 +1,20 @@ +//Function to display a random quote from the quotes array +function displayRandomQuote() { + const quote = pickFromArray(quotes); + document.getElementById("quote").innerText = `"${quote.quote}"`; + document.getElementById("author").innerText = `- ${quote.author}`; +} + +//Show one quote immediately when the page loads +window.onload = function () { + displayRandomQuote(); +}; + +//Add an event listener to the button to show a new quote when clicked +document.getElementById("new-quote").addEventListener("click", function () { + displayRandomQuote(); +}); + // DO NOT EDIT BELOW HERE // pickFromArray is a function which will return one item, at diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2..1bf564db3 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,55 @@ -/** Write your CSS in here **/ +body { + background-color: darkgoldenrod; /* Light gray background */ + display: flex; + flex-direction: column; /* Stack children vertically */ + justify-content: center; /* Center horizontally */ + align-items: center; /* Center vertically */ + height: 100vh; + margin: 0; + color: beige; +} + +.quote-container { + display: flex; + flex-direction: column; /* Stack quote and author vertically */ + background-color: lightgray; + padding: 20px; + border-radius: 10px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); + font-weight: bold; + color: darkslategray; + max-width: 600px; /* Limit the width of the quote container */ +} + +h1 { + font-size: 2.5em; + margin-bottom: 20px; + color: darkslategray; +} + +p { + margin: 10px 0; +} + +p#quote { + font-style: italic; + text-align: center; + font-size: 1.5em; +} + +p#author { + text-align: right; + font-weight: normal; +} + +#new-quote { + background-color: darkgoldenrod; + color: white; + border: none; + padding: 10px 20px; + border-radius: 5px; + cursor: pointer; +} +#new-quote:hover { + background-color: darkslategray; +}