Skip to content

Commit d26b16d

Browse files
committed
completed the quote generator app using DOM.
1 parent 4222cda commit d26b16d

3 files changed

Lines changed: 90 additions & 4 deletions

File tree

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,23 @@
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" />
8+
<link rel="preconnect" href="https://fonts.googleapis.com">
9+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10+
<link href="https://fonts.googleapis.com/css2?family=Chewy&display=swap" rel="stylesheet">
11+
712
<script defer src="quotes.js"></script>
13+
<script defer src="quote_generator.js"></script>
14+
815
</head>
916
<body>
10-
<h1>hello there</h1>
11-
<p id="quote"></p>
12-
<p id="author"></p>
17+
<div>
18+
<blockquote>
19+
<p id="quote"></p>
20+
<p id="author"></p>
21+
</blockquote>
1322
<button type="button" id="new-quote">New quote</button>
23+
</div>
1424
</body>
1525
</html>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const quote = document.getElementById("quote");
2+
const author = document.getElementById("author");
3+
const button = document.getElementById("new-quote");
4+
5+
function displayQuote() {
6+
const quoteAndAuthor = pickFromArray(quotes);
7+
quote.textContent = quoteAndAuthor.quote;
8+
author.textContent = quoteAndAuthor.author;
9+
}
10+
11+
displayQuote();
12+
13+
button.addEventListener("click", displayQuote);

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

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,64 @@
11
/** Write your CSS in here **/
2+
* {
3+
margin-top: 20px;
4+
padding: 0;
5+
box-sizing: border-box;
6+
}
7+
8+
body {
9+
font-family: "Chewy", system-ui;
10+
background-color: #ffc8dd;
11+
font-weight: 400;
12+
font-style: normal;
13+
display: flex;
14+
justify-content: center;
15+
align-items: center;
16+
}
17+
18+
div {
19+
background-color: #ffafcc;
20+
width: 700px;
21+
max-width: 90%;
22+
padding: 3rem;
23+
border-radius: 8px;
24+
}
25+
26+
blockquote {
27+
margin-bottom: 2rem;
28+
}
29+
30+
#quote {
31+
font-size: 2rem;
32+
color: black;
33+
line-height: 1.5;
34+
margin-bottom: 1.5rem;
35+
}
36+
37+
#author {
38+
text-align: right;
39+
font-size: 1.2rem;
40+
color: #e63946;
41+
}
42+
43+
button {
44+
display: block;
45+
margin-left: auto;
46+
background-color: #ef476f;
47+
color: white;
48+
border: none;
49+
padding: 0.8rem 1.5rem;
50+
font-size: 1rem;
51+
cursor: pointer;
52+
border-radius: 4px;
53+
}
54+
55+
button:hover {
56+
background-color: #d00000;
57+
}
58+
#quote::before {
59+
content: "❝ ";
60+
font-size: 2.5rem;
61+
}
62+
#quote::after {
63+
content: " ❞";
64+
}

0 commit comments

Comments
 (0)