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
33 changes: 20 additions & 13 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<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>
</head>
<body>
<h1>hello there</h1>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
</body>
</html>

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Quote Generator</title>
<script defer src="quotes.js"></script>
<link rel="stylesheet" href="style.css">
</head>

<body>
<div class="quote-box">
<h1>Quote of the Day</h1>
<p id="quote">"this is the quote"</p>
<p id="author">- Author Name</p>
</div>
<button type="button" id="new-quote" onclick="generateQuote()">New quote</button>
<script defer src="quotes.js"></script>
</body>

</html>
5 changes: 4 additions & 1 deletion Sprint-3/quote-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
"bugs": {
"url": "https://github.com/CodeYourFuture/CYF-Coursework-Template/issues"
},
"homepage": "https://github.com/CodeYourFuture/CYF-Coursework-Template#readme"
"homepage": "https://github.com/CodeYourFuture/CYF-Coursework-Template#readme",
"devDependencies": {
"@testing-library/jest-dom": "^6.9.1"
}
}
6 changes: 6 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,9 @@ const quotes = [
];

// call pickFromArray with the quotes array to check you get a random quote
function generateQuote() {
const randomQuote = pickFromArray(quotes);
document.getElementById("quote").textContent = `"${randomQuote.quote}"`;
document.getElementById("author").textContent = `- ${randomQuote.author}`;
}
generateQuote();
49 changes: 48 additions & 1 deletion Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
/** Write your CSS in here **/
body {
margin: 0;
padding: 0;
justify-content: center;
font-family: Arial, sans-serif;
background-color: #d4b4ec;
}

.quote-box {
margin: 50px auto;
width: 80%;
max-width: 600px;
padding: 30px;
text-align: center;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

h1 {
margin-bottom: 25px;
}
#quote {
min-height: 60px;
margin-bottom: 25px;
font-size: 1.5em;
line-height: 1.5;
font-style: italic;
}

button {
display: block;
margin: 20px auto;
font-weight: bold;
padding: 12px 20px;
font-size: 1.5em;
background-color: rgba(96, 55, 92, 0.2);
color: #232b2e;
border: none;
cursor: pointer;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

button:hover {
background-color: rgba(53, 31, 51, 0.2);
font-weight: bold;
text-shadow: 0 1px 2px white;
}
Loading