File tree 17 files changed +125
-101
lines changed
17 files changed +125
-101
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "compilerOptions" : {
3
+ "baseUrl" : " src"
4
+ },
5
+ "include" : [
6
+ " src"
7
+ ],
8
+ "paths" : {
9
+ "assets" : [" ./assets/*" ],
10
+ "components" : [" ./components/*" ]
11
+ }
12
+ }
Original file line number Diff line number Diff line change 3
3
"version" : " 0.1.0" ,
4
4
"private" : true ,
5
5
"dependencies" : {
6
- "@testing-library/jest-dom" : " ^5.11.4" ,
7
- "@testing-library/react" : " ^11.1.0" ,
8
- "@testing-library/user-event" : " ^12.1.10" ,
9
6
"react" : " ^17.0.1" ,
10
7
"react-dom" : " ^17.0.1" ,
11
8
"react-scripts" : " 4.0.2" ,
34
31
" last 1 firefox version" ,
35
32
" last 1 safari version"
36
33
]
34
+ },
35
+ "devDependencies" : {
36
+ "@testing-library/jest-dom" : " ^5.11.9" ,
37
+ "@testing-library/react" : " ^11.2.5" ,
38
+ "@testing-library/user-event" : " ^12.6.3"
37
39
}
38
40
}
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+
3
+ export class Checkbox extends React . Component {
4
+ constructor ( props ) {
5
+ super ( props )
6
+
7
+ this . state = {
8
+ check : false ,
9
+ } ;
10
+ }
11
+
12
+ render ( ) {
13
+ const { name, label } = this . props
14
+
15
+ return (
16
+ < div >
17
+ < input
18
+ name = { name }
19
+ type = "checkbox"
20
+ checked = { this . state . checked ? 'checked' : '' }
21
+ />
22
+ < label > { label } </ label >
23
+ </ div >
24
+ ) ;
25
+ }
26
+ }
Original file line number Diff line number Diff line change
1
+ .game {
2
+ display : flex;
3
+ flex-direction : column;
4
+ align-items : center;
5
+ width : 40% ;
6
+ }
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import './Game.css'
3
+ import { Gitcoin } from './Gitcoin'
4
+ import { Score } from './Score'
5
+
6
+ export class Game extends React . Component {
7
+ constructor ( props ) {
8
+ super ( props )
9
+
10
+ this . state = {
11
+ clicks : 0
12
+ }
13
+ }
14
+
15
+ handleClick ( ) {
16
+ this . setState ( {
17
+ clicks : this . state . clicks + 1
18
+ } ) ;
19
+ }
20
+
21
+ render ( ) {
22
+ return (
23
+ < main className = "game" >
24
+ < Score clicks = { this . state . clicks } />
25
+ < Gitcoin onClick = { this . handleClick . bind ( this ) } />
26
+ </ main >
27
+ ) ;
28
+ }
29
+ }
Original file line number Diff line number Diff line change
1
+ .gitcoin {
2
+ display : block;
3
+ width : 15rem ;
4
+ height : 15rem ;
5
+ border : none;
6
+ background : transparent;
7
+ outline : none;
8
+ cursor : pointer;
9
+ }
10
+
11
+ .gitcoin > img {
12
+ width : 100% ;
13
+ }
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import './Gitcoin.css'
3
+ import githubIcon from 'assets/Github.png'
4
+
5
+ export class Gitcoin extends React . Component {
6
+ render ( ) {
7
+ const { onClick } = this . props
8
+
9
+ return (
10
+ < button
11
+ className = "gitcoin"
12
+ onClick = { onClick }
13
+ >
14
+ < img src = { githubIcon } alt = "Gitcoin" />
15
+ </ button >
16
+ ) ;
17
+ }
18
+ }
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+
3
+ export class Score extends React . Component {
4
+ render ( ) {
5
+ const { clicks } = this . props
6
+
7
+ return (
8
+ < h3 > { clicks } Clicks</ h3 >
9
+ ) ;
10
+ }
11
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import ReactDOM from 'react-dom' ;
3
- import './index.css' ;
4
- import App from './App' ;
5
3
import reportWebVitals from './reportWebVitals' ;
4
+ import { Game } from './components/CookieClicker/Game' ;
6
5
7
6
ReactDOM . render (
8
- < React . StrictMode >
9
- < App />
10
- </ React . StrictMode > ,
7
+ < Game /> ,
11
8
document . getElementById ( 'root' )
12
9
) ;
13
10
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1830
1830
lz-string "^1.4.4"
1831
1831
pretty-format "^26.6.2"
1832
1832
1833
- "@testing-library/jest-dom@^5.11.4 ":
1833
+ "@testing-library/jest-dom@^5.11.9 ":
1834
1834
version "5.11.9"
1835
1835
resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-5.11.9.tgz#e6b3cd687021f89f261bd53cbe367041fbd3e975"
1836
1836
integrity sha512-Mn2gnA9d1wStlAIT2NU8J15LNob0YFBVjs2aEQ3j8rsfRQo+lAs7/ui1i2TGaJjapLmuNPLTsrm+nPjmZDwpcQ==
1844
1844
lodash "^4.17.15"
1845
1845
redent "^3.0.0"
1846
1846
1847
- "@testing-library/react@^11.1.0 ":
1847
+ "@testing-library/react@^11.2.5 ":
1848
1848
version "11.2.5"
1849
1849
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-11.2.5.tgz#ae1c36a66c7790ddb6662c416c27863d87818eb9"
1850
1850
integrity sha512-yEx7oIa/UWLe2F2dqK0FtMF9sJWNXD+2PPtp39BvE0Kh9MJ9Kl0HrZAgEuhUJR+Lx8Di6Xz+rKwSdEPY2UV8ZQ==
1851
1851
dependencies:
1852
1852
"@babel/runtime" "^7.12.5"
1853
1853
"@testing-library/dom" "^7.28.1"
1854
1854
1855
- "@testing-library/user-event@^12.1.10 ":
1855
+ "@testing-library/user-event@^12.6.3 ":
1856
1856
version "12.6.3"
1857
1857
resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-12.6.3.tgz#4a77c56a48823cf8adebd0f57670e4a89c24d058"
1858
1858
integrity sha512-PCmbUKofE4SXA7l8jphZAbvv5H3c4ix34xPZ/GNe99fASX//msJRgiMbHIBP+GwRfgVG9c7zmkODSPu2X2vNRw==
You can’t perform that action at this time.
0 commit comments