File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 < head >
44 < meta charset ="UTF-8 " />
55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6- < title > Title here</ title >
6+ < title > Quote generator app</ title >
7+ < link rel ="stylesheet " href ="style.css ">
78 < script defer src ="quotes.js "> </ script >
89 </ head >
910 < body >
10- < h1 > hello there</ h1 >
11- < p id ="quote "> </ p >
12- < p id ="author "> </ p >
13- < button type ="button " id ="new-quote "> New quote</ button >
11+ < div class ="card ">
12+ < h1 id ="quote "> </ h1 >
13+ < p id ="author "> </ p >
14+ < button type ="button " id ="new-quote "> New quote</ button >
15+ </ div >
1416 </ body >
15- </ html >
17+ </ html >
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-environment-jsdom" : " ^30.3.0"
20+ }
1721}
Original file line number Diff line number Diff line change @@ -491,3 +491,22 @@ const quotes = [
491491] ;
492492
493493// call pickFromArray with the quotes array to check you get a random quote
494+
495+ const quoteText = document . querySelector ( "#quote" ) ;
496+ const authorText = document . querySelector ( "#author" ) ;
497+ const newQuoteBtn = document . querySelector ( "#new-quote" ) ;
498+
499+ function displayRandomQuote ( ) {
500+ // Use the provided pickFromArray function
501+ const randomQuote = pickFromArray ( quotes ) ;
502+
503+ // Update the text on the page
504+ quoteText . innerText = randomQuote . quote ;
505+ authorText . innerText = randomQuote . author ;
506+ }
507+
508+ // Display a quote immediately when the script runs
509+ displayRandomQuote ( ) ;
510+
511+ // Add the click event to the button
512+ newQuoteBtn . addEventListener ( "click" , displayRandomQuote ) ;
Original file line number Diff line number Diff line change 11/** Write your CSS in here **/
2+ body {
3+ background-color : # f3a638 ; /* The orange background */
4+ display : flex;
5+ justify-content : center;
6+ align-items : center;
7+ height : 100vh ;
8+ margin : 0 ;
9+ font-family : serif;
10+ }
11+
12+ .container {
13+ background-color : white;
14+ padding : 40px ;
15+ width : 60% ;
16+ box-shadow : 0 4px 8px rgba (0 , 0 , 0 , 0.1 );
17+ position : relative;
18+ }
19+
20+ # new-quote {
21+ background-color : # f3a638 ;
22+ color : white;
23+ border : none;
24+ padding : 10px 20px ;
25+ cursor : pointer;
26+ float : right;
27+ }
You can’t perform that action at this time.
0 commit comments