From d7eaca1460aec8c6bfec2a39fba52acd0fb3fd5e Mon Sep 17 00:00:00 2001 From: Arthur <> Date: Thu, 16 Jul 2026 15:05:32 +0100 Subject: [PATCH 1/3] quotes.js --- Sprint-3/quote-generator/quotes.js | 31 ++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..2bfba74b4 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -1,24 +1,42 @@ // DO NOT EDIT BELOW HERE - +// // pickFromArray is a function which will return one item, at // random, from the given array. -// + // Parameters // ---------- // choices: an array of items to pick from. // + // Returns // ------- // One item at random from the given array. // + // Examples of use // --------------- // 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)]; + +function pickFromArray(quotes) { + return quotes[Math.floor(Math.random() * quotes.length)]; } +// First condition: When a person click the button, it should generate back a quote; + +function updateWebpageWithQuote() { + const elem = document.querySelector("#quote"); + const elem2 = document.querySelector("#author"); + + // store into the variable + const elem3 = pickFromArray(quotes); + elem.innerText = elem3.quote; + elem2.innerText = elem3.author; +} + +// Second condition: when a person enter the website, it should have a quote appear; + +// Third condition: when a person clicks the button each time, it should have different quote. . // A list of quotes you can use in your app. // DO NOT modify this array, otherwise the tests may break! @@ -490,4 +508,9 @@ const quotes = [ }, ]; +const buttonElem = document.querySelector("#new-quote"); + +buttonElem.addEventListener("click", updateWebpageWithQuote); +updateWebpageWithQuote(); + // call pickFromArray with the quotes array to check you get a random quote From 0fe52e4c878d088d33870165c7e5aed0d7520caa Mon Sep 17 00:00:00 2001 From: Arthur <> Date: Thu, 16 Jul 2026 15:06:22 +0100 Subject: [PATCH 2/3] html --- Sprint-3/quote-generator/index.html | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..c868c216e 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -5,11 +5,21 @@ Title here + -

hello there

-

-

+
+
+ +

+

+ +
+ +
+ + + From 2d63f4df10fd1a355260fa4d5d56400b8a1ab139 Mon Sep 17 00:00:00 2001 From: Arthur <> Date: Thu, 16 Jul 2026 15:09:07 +0100 Subject: [PATCH 3/3] style.css --- Sprint-3/quote-generator/style.css | 60 ++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2..f4b3e09dc 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,61 @@ /** Write your CSS in here **/ +/** Write your CSS in here **/ + +body{ + +background-color:orange; +margin:0; +display: flex; +min-height: 100vh; +justify-content: center; +align-items:center; +} + + +.card{ +background-color: white; +padding:30px; +border-radius: 8px; +max-width: 500px; + +} + +.quote-container{ +display: flex; +align-items: flex-start; +gap: 15px; +} + +.quote-mark{ +font-size: 90px; +color: orange; +line-height: 1; +font-family: sans-serif; + +} + + +#quote{ + color: orange; + font-size: 24px; +} + +#author{ + color: orange; + font-size: 24px; +} + +.button-container{ +display:flex; +justify-content:flex-end; +min-height: 50px; + +} + +#new-quote{ +background-color: orange; +color:white; +border: none; +} + +