Skip to content

Commit b97b885

Browse files
committed
cleaning and fixing
1 parent 1b02199 commit b97b885

3 files changed

Lines changed: 22 additions & 40 deletions

File tree

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<link rel="stylesheet" href="style.css" />
6+
<link rel="stylesheet" href="style.css" />
77
<title>Quote generator app</title>
88
<script defer src="quotes.js"></script>
99
</head>
1010
<body>
1111
<div class="displayArea">
12-
<p id="quote"> <h1>hello there</h1></p>
13-
<p id="author">
14-
<h3>Quote by</h3>
15-
</p>
12+
<p id="quote">hello there</p>
13+
<p id="author">Quote by</p>
1614
<button type="button" id="new-quote">New quote</button>
1715
</div>
1816
</body>

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

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,7 @@
1-
// DO NOT EDIT BELOW HERE
2-
3-
// pickFromArray is a function which will return one item, at
4-
// random, from the given array.
5-
//
6-
// Parameters
7-
// ----------
8-
// choices: an array of items to pick from.
9-
//
10-
// Returns
11-
// -------
12-
// One item at random from the given array.
13-
//
14-
// Examples of use
15-
// ---------------
16-
// pickFromArray(['a','b','c','d']) // maybe returns 'c'
17-
18-
// You don't need to change this function
191
function pickFromArray(choices) {
202
return choices[Math.floor(Math.random() * choices.length)];
213
}
224

23-
// A list of quotes you can use in your app.
24-
// DO NOT modify this array, otherwise the tests may break!
255
const quotes = [
266
{
277
quote: "Life isn't about getting and having, it's about giving and being.",
@@ -490,24 +470,18 @@ const quotes = [
490470
},
491471
];
492472

493-
// getting access from the html
494-
const showquote = document.querySelector("displayArea");
495-
const areaOfQuote = document.querySelector("h1");
473+
const areaOfQuote = document.querySelector("#quote");
496474
const shufflebutton = document.querySelector("#new-quote");
497-
const AreaOfQuoteBy = document.querySelector("h3");
498-
499-
// call pickFromArray with the quotes array to check you get a random quote
475+
const AreaOfQuoteBy = document.querySelector("#author");
500476

501477
function quoteGenerator() {
502478
const entireQuote = pickFromArray(quotes);
503479
const quot = entireQuote.quote;
504480
const Author = entireQuote.author;
505-
areaOfQuote.textContent = `" ${quot} "`;
506-
AreaOfQuoteBy.textContent = `- ${Author}`;
481+
areaOfQuote.textContent = quot;
482+
AreaOfQuoteBy.textContent = Author;
507483
}
508-
//console.log(quoteGenerator);
509-
//console.log(quot);
510-
//console.log(Author);
484+
511485
quoteGenerator();
512-
//event handler
486+
513487
shufflebutton.addEventListener("click", quoteGenerator);

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,22 @@ body {
2727
border-bottom-width: 10px;
2828
}
2929

30-
h1 {
30+
#quote {
31+
display: block;
32+
font-size: 2em;
33+
margin-block-start: 0.67em;
34+
margin-block-end: 0.67em;
35+
font-weight: bold;
3136
text-align: center;
3237
margin-right: 20px;
3338
color: rgb(226, 203, 163);
3439
}
35-
h3 {
40+
#author {
41+
font-size: 1.17em;
42+
font-weight: bold;
43+
margin-block-start: 1em;
44+
margin-block-end: 1em;
45+
display: block;
3646
text-align: right;
3747
margin-right: 20px;
3848
color: rgb(226, 203, 163);

0 commit comments

Comments
 (0)