diff --git a/Sprint-1/fix/median.js b/Sprint-1/fix/median.js deleted file mode 100644 index 5c5b796e1..000000000 --- a/Sprint-1/fix/median.js +++ /dev/null @@ -1,14 +0,0 @@ -// Fix this implementation -// Start by running the tests for this function -// If you're in the Sprint-1 directory, you can run `npm test -- fix` to run the tests in the fix directory - -// Hint: Please consider scenarios when 'list' isn't an array, is empty, -// or contains values that aren't numbers (the function is expected to throw - see the tests). - -function calculateMedian(list) { - const middleIndex = Math.floor(list.length / 2); - const median = list.splice(middleIndex, 1)[0]; - return median; -} - -module.exports = calculateMedian; diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..b557f59c1 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -1,15 +1,24 @@ - + - Title here + + The Quote Generator + + + -

hello there

-

-

- +
+

Quote Generator

+ +

+ +

+ + +
diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..104f7ebf4 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -1,21 +1,5 @@ // 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)]; } @@ -491,3 +475,20 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote + +// ---------------------------------- +// YOUR CODE GOES BELOW THE ARRAY +// ---------------------------------- + +function showRandomQuote() { + const randomQuote = pickFromArray(quotes); + + document.getElementById("quote").textContent = randomQuote.quote; + document.getElementById("author").textContent = randomQuote.author; +} + +// Show a random quote when the page loads +showRandomQuote(); + +// Show another random quote when button is clicked +document.getElementById("new-quote").addEventListener("click", showRandomQuote); diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2..b3bd0cf20 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,56 @@ -/** Write your CSS in here **/ +body { + margin: 0; + min-height: 100vh; + + display: flex; + justify-content: center; + align-items: center; + + font-family: Arial, sans-serif; + background-color: #e6f2ff; +} + +/* Quote box */ +.quote-container { + width: 600px; + padding: 40px; + + text-align: center; + + background-color: white; + border-radius: 15px; + box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2); +} + +/* Quote text */ +#quote { + font-size: 28px; + font-weight: bold; + color: #333; + line-height: 1.5; +} + +/* Author */ +#author { + font-size: 20px; + color: #666; + font-style: italic; + margin-bottom: 30px; +} + +/* New quote button */ +#new-quote { + padding: 12px 25px; + border: none; + border-radius: 8px; + + background-color: #007bff; + color: white; + + font-size: 16px; + cursor: pointer; +} + +#new-quote:hover { + background-color: #0056b3; +} \ No newline at end of file