Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.
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
5 changes: 3 additions & 2 deletions week-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title here</title>
<title>Quote Generator</title>
<link rel="stylesheet" href="style.css">
<script defer src="quotes.js"></script>
</head>
<body>
<h1>hello there</h1>
<h1>Quote of the day</h1>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
Expand Down
13 changes: 13 additions & 0 deletions week-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
addEventListener("DOMContentLoaded", displayQuote);

const quoteElement = document.querySelector("#quote");
const authorElement = document.querySelector("#author");
const newQuote = document.querySelector("#new-quote");

function displayQuote() {
const randomQuote = pickFromArray(quotes);
quoteElement.textContent = `"${randomQuote.quote}"`;
authorElement.textContent = `- ${randomQuote.author}`;
}

newQuote.addEventListener("click", displayQuote);
// DO NOT EDIT BELOW HERE

// pickFromArray is a function which will return one item, at
Expand Down
28 changes: 28 additions & 0 deletions week-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
/** Write your CSS in here **/
body {
font-family: Arial, sans-serif;
background-color: #f1f7ff;
margin: 25% 10%;
padding: 5%;

}

h1 {
justify-content: center;
color: rgb(160, 38, 38);
}

button {
padding: 5px 10px;
background-color: rgb(209, 166, 141);
border-radius: 10px;
}

p {
justify-content: center;
color: rgb(75, 36, 36);
text-decoration: solid;
}

#author {
text-align: right;
}