Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title here</title>
<link rel="stylesheet" href="style.css" />
<title>Quote generator app</title>
<script defer src="quotes.js"></script>
</head>
<body>
<h1>hello there</h1>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
<div class="displayArea">
<p id="quote"> <h1>hello there</h1></p>
<p id="author">
<h3>Quote by</h3>
</p>
<button type="button" id="new-quote">New quote</button>
</div>
</body>
</html>
20 changes: 20 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,4 +490,24 @@ const quotes = [
},
];

// getting access from the html
const showquote = document.querySelector("displayArea");
const areaOfQuote = document.querySelector("h1");
const shufflebutton = document.querySelector("#new-quote");
const AreaOfQuoteBy = document.querySelector("h3");

// call pickFromArray with the quotes array to check you get a random quote

function quoteGenerator() {
const entireQuote = pickFromArray(quotes);
const quot = entireQuote.quote;
const Author = entireQuote.author;
areaOfQuote.textContent = `" ${quot} "`;
AreaOfQuoteBy.textContent = `- ${Author}`;
}
//console.log(quoteGenerator);
//console.log(quot);
//console.log(Author);
quoteGenerator();
//event handler
shufflebutton.addEventListener("click", quoteGenerator);
38 changes: 38 additions & 0 deletions Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,39 @@
/** Write your CSS in here **/
.displayArea {
position: fixed;
border-style: groove;
border-top-left-radius: 0%;
top: 50%;
left: 50%;
width: 75%;
transform: translate(-50%, -50%);
background-color: whitesmoke;
}
body {
background-color: rgb(223, 208, 182);
}
#new-quote {
border-style: outset;
font-size: larger;
color: whitesmoke;
margin-left: 80%;
margin-bottom: 10px;
background-color: rgb(226, 203, 163);
block-size: 50px;
}
#new-quote:hover {
color: black;
border-right-width: 10px;
border-bottom-width: 10px;
}

h1 {
text-align: center;
margin-right: 20px;
color: rgb(226, 203, 163);
}
h3 {
text-align: right;
margin-right: 20px;
color: rgb(226, 203, 163);
}
Loading