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

hello there

-

-

- +
+

+

+ +
- + \ No newline at end of file diff --git a/Sprint-3/quote-generator/package.json b/Sprint-3/quote-generator/package.json index 0f6f98917..d92db50c1 100644 --- a/Sprint-3/quote-generator/package.json +++ b/Sprint-3/quote-generator/package.json @@ -13,5 +13,9 @@ "bugs": { "url": "https://github.com/CodeYourFuture/CYF-Coursework-Template/issues" }, - "homepage": "https://github.com/CodeYourFuture/CYF-Coursework-Template#readme" + "homepage": "https://github.com/CodeYourFuture/CYF-Coursework-Template#readme", + "devDependencies": { + "@testing-library/jest-dom": "^6.9.1", + "jest-environment-jsdom": "^30.3.0" + } } diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..84d0aa7a0 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -491,3 +491,22 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote + +const quoteText = document.querySelector("#quote"); +const authorText = document.querySelector("#author"); +const newQuoteBtn = document.querySelector("#new-quote"); + +function displayRandomQuote() { + // Use the provided pickFromArray function + const randomQuote = pickFromArray(quotes); + + // Update the text on the page + quoteText.innerText = randomQuote.quote; + authorText.innerText = randomQuote.author; +} + +// Display a quote immediately when the script runs +displayRandomQuote(); + +// Add the click event to the button +newQuoteBtn.addEventListener("click", displayRandomQuote); \ No newline at end of file diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2..f97f31037 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,27 @@ /** Write your CSS in here **/ +body { + background-color: #f3a638; /* The orange background */ + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; + font-family: serif; +} + +.container { + background-color: white; + padding: 40px; + width: 60%; + box-shadow: 0 4px 8px rgba(0,0,0,0.1); + position: relative; +} + +#new-quote { + background-color: #f3a638; + color: white; + border: none; + padding: 10px 20px; + cursor: pointer; + float: right; +} \ No newline at end of file