Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
5 changes: 3 additions & 2 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<!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>
Expand Down
17 changes: 17 additions & 0 deletions Sprint-3/quote-generator/quotes.js

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make the app to display a quote when the page is first loaded?

Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// Goal: page shows a random quote from the quotes array with displaying the author
// requirements:
// when clicking a button on the screen it changes the quote
const author = document.getElementById("author");
const quote = document.getElementById("quote");
const newQuoteButton = document.getElementById("new-quote");

newQuoteButton.addEventListener("click", () => {
displayQuote();
});

function displayQuote() {
const randomQuote = pickFromArray(quotes);
quote.textContent = randomQuote.quote;
author.textContent = randomQuote.author;
}

// DO NOT EDIT BELOW HERE

// pickFromArray is a function which will return one item, at
Expand Down
8 changes: 8 additions & 0 deletions Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
/** Write your CSS in here **/
body{
font-family: Arial,sans-serif;
min-height: 100vh;
margin:0;
display: flex;
padding: 0 1rem;
background-color: #dd7a7a
}
Loading