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
5 changes: 3 additions & 2 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title here</title>
<script defer src="quotes.js"></script>
<title>Quote generator app</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>hello there</h1>
<p id="quote"></p>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is there a semantic html element you could use here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Surely, I have applied blockquote and cite

<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
<script defer src="quotes.js"></script>
</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

function displayQuote() {
const picked = pickFromArray(quotes);
document.getElementById("quote").innerText = picked.quote;
document.getElementById("author").innerText = picked.author;
}

document.addEventListener("DOMContentLoaded", () => {
displayQuote();
document.getElementById("new-quote").addEventListener("click", displayQuote);
});
30 changes: 29 additions & 1 deletion Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
/** Write your CSS in here **/
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 60vh;
margin: 0;
font-family: 'Courier New', Courier, monospace;
}


h1, p, button, blockquote, cite {
margin: 30px;
text-align: center;
}

cite {
display: block;
font-style: italic;
color: #555;
}

#new-quote {
display: block;
margin: 20px auto;
padding: 10px 20px;
cursor: pointer;
margin-top: 20px;
}