Skip to content
Open
15 changes: 9 additions & 6 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<!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>Quote generator app</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>
<main class="card">
<h1>Quote Generator</h1>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
</main>
</body>
</html>
13 changes: 13 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,16 @@ const quotes = [
];

// call pickFromArray with the quotes array to check you get a random quote
const quoteElement = document.getElementById("quote");
const authorElement = document.getElementById("author");
const newQuoteButton = document.getElementById("new-quote");

function showRandomQuote() {
const randomQuote = pickFromArray(quotes);
quoteElement.textContent = randomQuote.quote;
authorElement.textContent = "- " + randomQuote.author;
}

showRandomQuote();

newQuoteButton.addEventListener("click", showRandomQuote);
62 changes: 61 additions & 1 deletion Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,61 @@
/** Write your CSS in here **/
* {
box-sizing: border-box;
}

body {
margin: 0;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(135deg, #667eea, #764ba2);
font-family: Georgia, "Times New Roman", Times, serif;
padding: 1rem;
}

.card {
background: #ffffff;
max-width: 600px;
width: 100%;
padding: 2rem;
border-radius: 12px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
text-align: center;
}

h1 {
margin-top: 0;
font-size: 1rem;
letter-spacing: 0.15em;
text-transform: uppercase;
color: #888;
}

#quote {
font-size: 1.5rem;
line-height: 1.5;
font-style: italic;
color: #222;
margin: 1.5rem 0 1rem;
}

button {
background: #764ba2;
color: #ffffff;
border: none;
padding: 0.75rem 1.75rem;
font-size: 1rem;
border-radius: 999px;
cursor: pointer;
transition:
background 0.2s,
transform 0.1s;
}

button:hover {
background: #5d3a85;
}

button:active {
transform: scale(0.96);
}
Loading