diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..d51656a9a 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -1,15 +1,24 @@ - - - - Title here - - - -

hello there

-

-

- - - + + + + + Quote generator app + + + + + + + +

Quote Generator app

+ +

+

+ + + + + + \ No newline at end of file diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..d39995283 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -1,3 +1,34 @@ + +// Select elements +const quoteEl = document.getElementById("quote"); +const authorEl = document.getElementById("author"); +const button = document.getElementById("new-quote"); + + +// Function to show a random quote +function showRandomQuote() { + const randomIndex = Math.floor(Math.random() * quotes.length); + const randomQuote = quotes[randomIndex]; + + quoteEl.textContent = randomQuote.quote; + authorEl.textContent = `— ${randomQuote.author}`; +} + +function pickFromArray(choices) { + return choices[Math.floor(Math.random() * choices.length)]; +} + +// Show a quote when the page loads +window.addEventListener("DOMContentLoaded", () => { + showRandomQuote(); +}); + +// Change quote when button is clicked +button.addEventListener("click", showRandomQuote); + + + + // 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..f61c1d7c8 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,67 @@ /** Write your CSS in here **/ + +/* Reset some default spacing */ +body, +h1, +p { + margin: 0; + padding: 0; +} + +/* Page styling */ +body { + font-family: "Segoe UI", Arial, sans-serif; + background: linear-gradient(135deg, #4b79a1, #283e51); + color: #ffffff; + height: 100vh; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + text-align: center; + padding: 20px; +} + +/* Title */ +h1 { + font-size: 2.5rem; + margin-bottom: 20px; + letter-spacing: 1px; +} + +/* Quote text */ +#quote { + font-size: 1.6rem; + font-weight: 300; + max-width: 700px; + margin-bottom: 10px; +} + +/* Author text */ +#author { + font-size: 1.2rem; + font-style: italic; + opacity: 0.8; + margin-bottom: 30px; +} + +/* Button styling */ +#new-quote { + background-color: #ffffff; + color: #283e51; + border: none; + padding: 12px 25px; + font-size: 1rem; + border-radius: 6px; + cursor: pointer; + transition: 0.3s ease; +} + +#new-quote:hover { + background-color: #dfe6e9; + transform: scale(1.05); +} + +#new-quote:active { + transform: scale(0.98); +} \ No newline at end of file