Skip to content

Commit 1b02199

Browse files
committed
quote_generator task under sprint 3 has been done
1 parent de6889c commit 1b02199

3 files changed

Lines changed: 67 additions & 5 deletions

File tree

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
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+
<link rel="stylesheet" href="style.css" />
7+
<title>Quote generator app</title>
78
<script defer src="quotes.js"></script>
89
</head>
910
<body>
10-
<h1>hello there</h1>
11-
<p id="quote"></p>
12-
<p id="author"></p>
13-
<button type="button" id="new-quote">New quote</button>
11+
<div class="displayArea">
12+
<p id="quote"> <h1>hello there</h1></p>
13+
<p id="author">
14+
<h3>Quote by</h3>
15+
</p>
16+
<button type="button" id="new-quote">New quote</button>
17+
</div>
1418
</body>
1519
</html>

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,4 +490,24 @@ const quotes = [
490490
},
491491
];
492492

493+
// getting access from the html
494+
const showquote = document.querySelector("displayArea");
495+
const areaOfQuote = document.querySelector("h1");
496+
const shufflebutton = document.querySelector("#new-quote");
497+
const AreaOfQuoteBy = document.querySelector("h3");
498+
493499
// call pickFromArray with the quotes array to check you get a random quote
500+
501+
function quoteGenerator() {
502+
const entireQuote = pickFromArray(quotes);
503+
const quot = entireQuote.quote;
504+
const Author = entireQuote.author;
505+
areaOfQuote.textContent = `" ${quot} "`;
506+
AreaOfQuoteBy.textContent = `- ${Author}`;
507+
}
508+
//console.log(quoteGenerator);
509+
//console.log(quot);
510+
//console.log(Author);
511+
quoteGenerator();
512+
//event handler
513+
shufflebutton.addEventListener("click", quoteGenerator);

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,39 @@
11
/** Write your CSS in here **/
2+
.displayArea {
3+
position: fixed;
4+
border-style: groove;
5+
border-top-left-radius: 0%;
6+
top: 50%;
7+
left: 50%;
8+
width: 75%;
9+
transform: translate(-50%, -50%);
10+
background-color: whitesmoke;
11+
}
12+
body {
13+
background-color: rgb(223, 208, 182);
14+
}
15+
#new-quote {
16+
border-style: outset;
17+
font-size: larger;
18+
color: whitesmoke;
19+
margin-left: 80%;
20+
margin-bottom: 10px;
21+
background-color: rgb(226, 203, 163);
22+
block-size: 50px;
23+
}
24+
#new-quote:hover {
25+
color: black;
26+
border-right-width: 10px;
27+
border-bottom-width: 10px;
28+
}
29+
30+
h1 {
31+
text-align: center;
32+
margin-right: 20px;
33+
color: rgb(226, 203, 163);
34+
}
35+
h3 {
36+
text-align: right;
37+
margin-right: 20px;
38+
color: rgb(226, 203, 163);
39+
}

0 commit comments

Comments
 (0)