File tree Expand file tree Collapse file tree 3 files changed +122
-0
lines changed Expand file tree Collapse file tree 3 files changed +122
-0
lines changed Original file line number Diff line number Diff line change 1+ let countEl = document . getElementById ( "count" ) ;
2+ let saveEl = document . getElementById ( "save" ) ;
3+ let incrementBtn = document . querySelector ( ".increment-btn" ) ;
4+ let saveBtn = document . querySelector ( ".save-btn" ) ;
5+
6+ let count = 0 ;
7+
8+ incrementBtn . addEventListener ( "click" , ( ) => {
9+ count += 1 ;
10+ countEl . textContent = count ;
11+ } ) ;
12+
13+ saveBtn . addEventListener ( "click" , ( ) => {
14+ let countStr = count + ", " ;
15+ saveEl . textContent += countStr ;
16+ countEl . textContent = 0 ;
17+ count = 0 ;
18+ } ) ;
Original file line number Diff line number Diff line change 1+ < html lang ="en ">
2+ < head >
3+ < meta charset ="UTF-8 " />
4+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge " />
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6+ < title > Counter</ title >
7+ < link rel ="stylesheet " href ="style.css " />
8+ </ head >
9+ < body >
10+ < main class ="content ">
11+ < div class ="counter ">
12+ < div class ="counter-box " id ="count "> 0</ div >
13+ < button class ="increment-btn button "> INCREMENT</ button >
14+ < button class ="save-btn button "> SAVE</ button >
15+ </ div >
16+
17+ < div class ="entries ">
18+ < p > SAVE / ENTRIES</ p >
19+ < div class ="entries-field " id ="save "> </ div >
20+ </ div >
21+ </ main >
22+
23+ < script src ="app.js "> </ script >
24+ </ body >
25+ </ html >
Original file line number Diff line number Diff line change 1+ * {
2+ margin : 0 ;
3+ padding : 0 ;
4+ box-sizing : border-box;
5+ }
6+
7+ button {
8+ border : none;
9+ outline : none;
10+ }
11+
12+ body {
13+ font-family : sans-serif;
14+ background-color : black;
15+ }
16+
17+ .content {
18+ max-width : 1440px ;
19+ margin : 0 auto;
20+ padding : 0 10rem ;
21+ }
22+
23+ .counter {
24+ display : flex;
25+ flex-direction : column;
26+ align-items : center;
27+ margin-top : 1rem ;
28+ }
29+
30+ .counter-box {
31+ width : 100% ;
32+ height : 160px ;
33+ display : flex;
34+ justify-content : center;
35+ align-items : center;
36+ color : # fff ;
37+ font-size : 100px ;
38+ font-weight : 600 ;
39+ background-color : rgba (43 , 42 , 42 , 0.959 );
40+ border-radius : 8px ;
41+ }
42+
43+ .button {
44+ width : 80% ;
45+ max-width : 350px ;
46+ height : 3em ;
47+ display : flex;
48+ justify-content : center;
49+ align-items : center;
50+ color : # fff ;
51+ font-size : 20px ;
52+ font-weight : 400 ;
53+ border-radius : 8px ;
54+ cursor : pointer;
55+ user-select : none;
56+ }
57+
58+ .increment-btn {
59+ margin : 2em 0 1em 0 ;
60+ background-color : rgb (26 , 26 , 184 );
61+ font-weight : bold;
62+ }
63+
64+ .save-btn {
65+ background-color : # 00da7f ;
66+ font-weight : bold;
67+ }
68+
69+ .entries p {
70+ margin : 2.5rem 0 1em 0 ;
71+ font-size : 20px ;
72+ font-weight : 600 ;
73+ color : # fff ;
74+ }
75+
76+ .entries-field {
77+ font-size : 20px ;
78+ color : # fff ;
79+ }
You can’t perform that action at this time.
0 commit comments