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
12 changes: 7 additions & 5 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
<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>
<p id="author"></p>
<div id="card">
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
</div>
<script src="quotes.js"></script>
</body>
</html>
7 changes: 6 additions & 1 deletion Sprint-3/quote-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@
"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",
"dependencies": {
"@testing-library/jest-dom": "^6.9.1",
"jest": "^30.3.0",
"jsdom": "^26.1.0"
}
}
17 changes: 16 additions & 1 deletion Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,4 +490,19 @@ const quotes = [
},
];

// call pickFromArray with the quotes array to check you get a random quote
function quoteGenerator()
{

let randomQuote = pickFromArray(quotes);
let accessQuote = document.querySelector("#quote");
accessQuote.textContent = randomQuote.quote;
let accessAuthor = document.querySelector("#author");
accessAuthor.textContent = randomQuote.author;

}

quoteGenerator();
let newQuote = document.querySelector("#new-quote");
newQuote.addEventListener("click",quoteGenerator)


1 change: 1 addition & 0 deletions Sprint-3/quote-generator/quotes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ describe("Quote generator", () => {
expect(authorP).toHaveTextContent("Rosa Parks");
});
});

37 changes: 36 additions & 1 deletion Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
/** Write your CSS in here **/
body{
background-color:orange;
padding: 200px;
padding-right: 300px;
text-align: center;
font-weight: bold;
font-family:'Times New Roman', Times, serif;
font-size: 20px;
}
#quote{
color:orange;
padding: 20px;
font-size: 30px;
}
#author{
color:orange;
text-align: right;
font-size: 25px;
margin-top: 20px;
}
#card{
background-color: white;
padding: 40px;
margin-top: 20px;
}
#new-quote{
background-color: orange;
color: white;
display: block;
margin-left: auto;
margin-top: 10px;
padding: 10px 20px;
border: none;
font-size: 20px;
cursor: pointer;
}
Loading