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
12 changes: 8 additions & 4 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
<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>

<div class="container">
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New Quote</button>
</div>
</body>
</html>
19 changes: 19 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,22 @@ const quotes = [
];

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


const quoteElement = document.getElementById("quote");
const authorElement = document.getElementById("author");
const button = document.getElementById("new-quote");

function showQuote() {
const randomQuote = pickFromArray(quotes);

quoteElement.textContent = randomQuote.quote;
authorElement.textContent =randomQuote.author;
}

function setup() {
button.addEventListener("click", showQuote);
showQuote();
}

window.addEventListener("load", setup);
33 changes: 33 additions & 0 deletions Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
/** Write your CSS in here **/
body {
font-family: Arial, sans-serif;
background-color: purple;
text-align: center;
padding: 50px;
}

.container {
background: blue;
padding: 20px;
border-radius: 10px;
display: inline-block;
}

#quote {
font-size: 1.5em;
margin-bottom: 10px;
}

#author {
font-style: italic;
margin-bottom: 20px;
}

button {
padding: 10px 20px;
font-size: 1em;
cursor: pointer;
}

.autoplay {
margin-top: 20px;
}
Loading