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
19 changes: 14 additions & 5 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@
<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>
<script defer src="quotes.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>hello there</h1>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
<header>
<h1>Quote Generator</h1>
</header>
<main>
<section>
<blockquote id="quote"></blockquote>
<p id="author"></p>
</section>
</main>
<section>
<button type="button" id="new-quote">New quote</button>
</section>
</body>
</html>
21 changes: 21 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,24 @@ const quotes = [
];

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

// 1. get a button variable.
// 2. listen to the event.
// 3, when event happens produce a quote in one place <p>
//4. when an event happens produce author of that quote in the other <p>
const button = document.querySelector("#new-quote");
const initialQuote = pickFromArray(quotes);
const quotePlacement = document.querySelector("#quote");
const authorPlacement = document.querySelector("#author");
quotePlacement.innerText = `${initialQuote.quote}`;
authorPlacement.innerText = `${initialQuote.author}`;

function newQuoteEveryTime() {
const quote = pickFromArray(quotes);
//const quotePlace = document.querySelector("#quote");
//const authorPlace = document.querySelector("#author");
quotePlacement.innerText = `${quote.quote}`;
authorPlacement.innerText = `${quote.author}`;
}

button.addEventListener("click", newQuoteEveryTime);
46 changes: 46 additions & 0 deletions Sprint-3/quote-generator/style.css

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

On my device, the browser shows a scrollbar here that isn't necessary, can you figure out why?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

Original file line number Diff line number Diff line change
@@ -1 +1,47 @@
h1 {
font-size: 24px;
text-align: center;
color: rgb(225, 71, 36);
}

body {
margin: 0;
font-family: Arial, sans-serif;
background: rgb(24, 25, 24);

display: flex;
flex-direction: column;
align-items: center;

min-height: 100dvh;

}
#quote {
max-width: 700px;
min-height: 160px;

text-align: center;
font-size: 24px;
color: rgb(225, 71, 36);
}

#author {
width: 700px;
text-align: right;
font-style: italic;
color: rgb(225, 71, 36);
}

#new-quote {
padding: 12px 30px;
font-size: 18px;
color: white;
background-color: rgb(225, 71, 36);
cursor: pointer;
}





/** Write your CSS in here **/
Loading