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
22 changes: 17 additions & 5 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,25 @@
<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>
<p id="quote"></p>
<p id="author"></p>
<div></div>
</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 placeInitialQuote = document.querySelector("#quote");
const placeInitialAuthor = document.querySelector("#author");
placeInitialQuote.innerText = `${initialQuote.quote}`;
placeInitialAuthor.innerText = `${initialQuote.author}`;

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

button.addEventListener("click", newQuoteEveryTime);
45 changes: 45 additions & 0 deletions Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,46 @@
h1 {
font-size: 24px;
text-align: center;
color: rgb(225, 71, 36);
}

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

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

min-height: 100vh;
}
#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