Skip to content
Closed
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
13 changes: 8 additions & 5 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
<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</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>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor feedback: it is good UX to always highlight when a button is hovered on. you should look up the css :hover and cursor properties. you can start here: https://stackoverflow.com/questions/8762201/how-to-get-the-cursor-to-change-to-the-hand-when-hovering-a-button-tag

good implementation overall. 👍

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the feedback and i have now made the requested changes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excellent. well done!

</div>
</body>
</html>
11 changes: 11 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,14 @@ const quotes = [
];

// call pickFromArray with the quotes array to check you get a random quote
let quote = document.getElementById("quote");
let author = document.getElementById("author");
let quoteButton = document.getElementById("new-quote");

function displayQuote() {
let randomQuote = pickFromArray(quotes);
quote.textContent = `"${randomQuote.quote}"`;
author.textContent = `-${randomQuote.author}`;
}
displayQuote();
quoteButton.addEventListener("click", displayQuote);
34 changes: 34 additions & 0 deletions Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
/** Write your CSS in here **/
body {
background-color: antiquewhite;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
font-family: Arial, Helvetica, sans-serif;
}

div {
background-color: azure;
width: 500px;
padding: 60px;
border-radius: 10px;
box-shadow: 5px 5px 10px black;
}

#quote {
font-size: 24px;
}

#author {
font-size: 18px;
}

#new-quote {
padding: 16px 10px;
border-radius: 10px;
cursor: pointer;
}

#new-quote:hover {
color: red;
}