Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions Sprint-1/fix/median.js

This file was deleted.

21 changes: 15 additions & 6 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title here</title>

<title>The Quote Generator</title>

<link rel="stylesheet" href="style.css" />
<script defer src="quotes.js"></script>
</head>

<body>
<h1>hello there</h1>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
<div class="quote-box">
<h1>Quote Generator</h1>

<p id="quote"></p>

<p id="author"></p>

<button type="button" id="new-quote">New Quote</button>
</div>
</body>
</html>
33 changes: 17 additions & 16 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
@@ -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)];
}
Expand Down Expand Up @@ -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);
57 changes: 56 additions & 1 deletion Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -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;
}
Loading