Skip to content

Commit 2bd8bea

Browse files
committed
Create quote generator layout and functionality
1 parent 2a50749 commit 2bd8bea

4 files changed

Lines changed: 66 additions & 4 deletions

File tree

‎Sprint-3/quote-generator/index.html‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>Title here</title>
7-
<script defer src="quotes.js"></script>
6+
<title>Quote generator app</title>
7+
8+
<link rel="stylesheet" href="style.css" />
9+
10+
<script src="quotes.js"></script>
811
</head>
912
<body>
1013
<h1>hello there</h1>

‎Sprint-3/quote-generator/quotes.js‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,3 +491,18 @@ const quotes = [
491491
];
492492

493493
// call pickFromArray with the quotes array to check you get a random quote
494+
495+
const quoteElement = document.querySelector("#quote");
496+
const authorElement = document.querySelector("#author");
497+
const newQuoteButton = document.querySelector("#new-quote");
498+
499+
function displayRandomQuote() {
500+
const randomQuote = pickFromArray(quotes);
501+
502+
quoteElement.textContent = randomQuote.quote;
503+
authorElement.textContent = randomQuote.author;
504+
}
505+
506+
displayRandomQuote();
507+
508+
newQuoteButton.addEventListener("click", displayRandomQuote);

‎Sprint-3/quote-generator/style.css‎

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,46 @@
1-
/** Write your CSS in here **/
1+
body {
2+
background-color: white;
3+
font-family: Arial, sans-serif;
4+
display: flex;
5+
justify-content: center;
6+
align-items: center;
7+
min-height: 100vh;
8+
}
9+
10+
11+
.outer-container {
12+
background-color: orange;
13+
padding: 30px;
14+
text-align: center;
15+
}
16+
17+
18+
.quote-box {
19+
background-color: white;
20+
color: orange;
21+
padding: 40px;
22+
width: 400px;
23+
margin-bottom: 20px;
24+
}
25+
26+
27+
#quote {
28+
font-size: 24px;
29+
font-weight: bold;
30+
}
31+
32+
33+
#author {
34+
font-size: 18px;
35+
font-style: italic;
36+
}
37+
38+
39+
#new-quote {
40+
background-color: orange;
41+
color: white;
42+
border: none;
43+
padding: 15px 30px;
44+
font-size: 18px;
45+
cursor: pointer;
46+
}

‎Sprint-3/slideshow/style.css‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)