File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313 "bugs" : {
1414 "url" : " https://github.com/CodeYourFuture/CYF-Coursework-Template/issues"
1515 },
16- "homepage" : " https://github.com/CodeYourFuture/CYF-Coursework-Template#readme"
16+ "homepage" : " https://github.com/CodeYourFuture/CYF-Coursework-Template#readme" ,
17+ "devDependencies" : {
18+ "@testing-library/jest-dom" : " ^6.9.1" ,
19+ "jest" : " ^30.3.0" ,
20+ "jest-environment-jsdom" : " ^30.3.0"
21+ }
1722}
Original file line number Diff line number Diff line change @@ -491,3 +491,21 @@ const quotes = [
491491] ;
492492
493493// call pickFromArray with the quotes array to check you get a random quote
494+
495+ const quoteElement = document . getElementById ( "quote" ) ;
496+ const authorElement = document . getElementById ( "author" ) ;
497+
498+ function displayQuote ( ) {
499+ const randomQuote = pickFromArray ( quotes ) ;
500+
501+ quoteElement . textContent = randomQuote . quote ;
502+ authorElement . textContent = randomQuote . author ;
503+ }
504+
505+ // Show a quote when page loads
506+ displayQuote ( ) ;
507+
508+ // Change quote when button is clicked
509+ document
510+ . getElementById ( "new-quote" )
511+ . addEventListener ( "click" , displayQuote ) ;
Original file line number Diff line number Diff line change 11/** Write your CSS in here **/
2+ body {
3+ font-family : Arial, sans-serif;
4+ text-align : center;
5+ margin-top : 50px ;
6+ background-color : # f5f5f5 ;
7+ }
8+
9+ h1 {
10+ color : # 333 ;
11+ }
12+
13+ # quote {
14+ font-size : 24px ;
15+ margin : 20px ;
16+ font-style : italic;
17+ }
18+
19+ # author {
20+ font-size : 18px ;
21+ color : # 666 ;
22+ }
23+
24+ button {
25+ padding : 10px 20px ;
26+ font-size : 16px ;
27+ cursor : pointer;
28+ border : none;
29+ background-color : # 333 ;
30+ color : white;
31+ border-radius : 5px ;
32+ }
33+
34+ button : hover {
35+ background-color : # 555 ;
36+ }
You can’t perform that action at this time.
0 commit comments