Skip to content

Commit 0cc51cd

Browse files
committed
complete build of quote generator app
1 parent 96d077b commit 0cc51cd

3 files changed

Lines changed: 53 additions & 1 deletion

File tree

Sprint-3/quote-generator/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>Title here</title>
6+
<title>Quote generator app</title>
7+
<link rel="stylesheet" href="style.css">
78
<script defer src="quotes.js"></script>
89
</head>
910
<body>

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+
function displayRandomQuote() {
496+
const randomQuote = pickFromArray(quotes);
497+
498+
document.getElementById("quote").textContent = randomQuote.quote;
499+
document.getElementById("author").textContent = randomQuote.author;
500+
}
501+
502+
// run when page loads2
503+
displayRandomQuote();
504+
505+
// button click
506+
document
507+
.getElementById("new-quote")
508+
.addEventListener("click", displayRandomQuote);

Sprint-3/quote-generator/style.css

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,37 @@
11
/** Write your CSS in here **/
2+
body {
3+
font-family: Arial, sans-serif;
4+
background-color: #f4f4f4;
5+
text-align: center;
6+
padding: 50px;
7+
}
8+
9+
h1 {
10+
color: #333;
11+
}
12+
13+
#quote {
14+
font-size: 1.5rem;
15+
margin: 20px 0;
16+
color: #222;
17+
}
18+
19+
#author {
20+
font-size: 1.2rem;
21+
color: #666;
22+
margin-bottom: 30px;
23+
}
24+
25+
button {
26+
padding: 10px 20px;
27+
font-size: 1rem;
28+
background-color: #007BFF;
29+
color: white;
30+
border: none;
31+
border-radius: 5px;
32+
cursor: pointer;
33+
}
34+
35+
button:hover {
36+
background-color: #0056b3;
37+
}

0 commit comments

Comments
 (0)