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
38 changes: 35 additions & 3 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,45 @@
<!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>
<style>
body {
display: grid;
place-items: center;
min-height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
text-align: center;
margin-top: 40px;
background-color: aqua;
}
h1 {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
color: green;
}

#quote {
font-size: 45px;
margin-bottom: 10px;
color: purple;
}
#author {
font-size: 30px;
color: red;
margin-bottom: 10px;
font-family: Cambria, Cochin, Georgia, Times, "Times New Roman", serif;
}
#new-quote {
padding: 10px 20px;
font-size: 16px;
}
</style>
<script defer src="quotes.js"></script>
</head>
<body>
<h1>hello there</h1>
<h1>Welcome to the Quote Generator</h1>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
Expand Down
17 changes: 17 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// DO NOT EDIT ABOVE HERE
window.addEventListener("DOMContentLoaded", () => {
const quoteElement = document.getElementById("quote");
const authorElement = document.getElementById("author");
const newQuoteBtn = document.getElementById("new-quote");

function displayRandomQuote() {
const randomQuote = pickFromArray(quotes);
quoteElement.textContent = `"${randomQuote.quote}"`;
authorElement.textContent = randomQuote.author;
}

displayRandomQuote();

newQuoteBtn.addEventListener("click", displayRandomQuote);
});

// DO NOT EDIT BELOW HERE

// pickFromArray is a function which will return one item, at
Expand Down
Loading