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
17 changes: 11 additions & 6 deletions Sprint-3/quote-generator/index.html
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
<!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>
<h1>Quote Generator</h1>

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

<button type="button" id="new-quote">New quote</button>
</main>
</body>
</html>
17 changes: 17 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -491,3 +491,20 @@ const quotes = [
];

// call pickFromArray with the quotes array to check you get a random quote

function displayRandomQuote() {
const selectedQuote = pickFromArray(quotes);

document.getElementById("quote").textContent = selectedQuote.quote;
document.getElementById("author").textContent = selectedQuote.author;
}

function setup() {
const newQuoteButton = document.getElementById("new-quote");

newQuoteButton.addEventListener("click", displayRandomQuote);

displayRandomQuote();
}

window.onload = setup;
56 changes: 56 additions & 0 deletions Sprint-3/quote-generator/style.css
Original file line numberDiff line numberDiff line change
@@ -1 +1,57 @@
/** Write your CSS in here **/
* {
box-sizing: border-box;
}

body {
margin: 0;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: #333;
}

main {
width: 90%;
max-width: 600px;
padding: 40px;
text-align: center;
background-color: white;
border-radius: 12px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

h1 {
margin-bottom: 30px;
color: #444;
}

blockquote {
margin: 0 0 20px;
font-size: 1.5rem;
line-height: 1.5;
font-style: italic;
}

#author {
margin-bottom: 30px;
font-weight: bold;
color: #777;
}

button {
padding: 12px 24px;
border: none;
border-radius: 6px;
background-color: #333;
color: white;
font-size: 1rem;
cursor: pointer;
}

button:hover {
background-color: #555;
}
Loading