-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f7f2b8e
Showing
33 changed files
with
8,748 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"extends": "airbnb", | ||
"parser": "babel-eslint", | ||
"plugins": [ | ||
"jest" | ||
], | ||
"rules": { | ||
"no-plusplus": "off", | ||
"react/jsx-filename-extension": "off", | ||
"react/prop-types": ["error", {"ignore": [ | ||
"style", | ||
"dispatch", | ||
"match" | ||
]}] | ||
}, | ||
"env": { | ||
"jest/globals": true, | ||
"browser": true | ||
}, | ||
"settings": { | ||
"import/resolver": { | ||
"babel-module": {}, | ||
"node": { | ||
"extensions": [ | ||
".js", | ||
".android.js", | ||
".ios.js" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
node_modules/ | ||
# See https://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
To save the ponies: | ||
|
||
0. Make sure you have NodeJS >=9.3.0 installed; | ||
1. Navigate to project's root dir; | ||
2. Run `npm install` or `yarn install`; | ||
4. Start up the app by `npm start` or `yarn start`; | ||
5. Open `http://localhost:3000` in your browser and enjoy the game :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "pony", | ||
"version": "0.1.0", | ||
"private": true, | ||
"dependencies": { | ||
"axios": "^0.18.0", | ||
"immutability-helper": "^2.6.6", | ||
"lodash": "^4.17.5", | ||
"prop-types": "^15.6.1", | ||
"react": "^16.2.0", | ||
"react-autobind": "^1.0.6", | ||
"react-dom": "^16.2.0", | ||
"react-redux": "^5.0.7", | ||
"react-scripts": "1.1.1", | ||
"redux": "^3.7.2", | ||
"redux-thunk": "^2.2.0", | ||
"styled-components": "^3.2.0", | ||
"uuid": "^3.2.1" | ||
}, | ||
"scripts": { | ||
"start": "react-scripts start", | ||
"build": "react-scripts build", | ||
"test": "react-scripts test /*.spec.js --env=jsdom", | ||
"eject": "react-scripts eject", | ||
"lint": "node node_modules/.bin/eslint ./" | ||
}, | ||
"devDependencies": { | ||
"eslint-config-airbnb": "^16.1.0", | ||
"eslint-plugin-import": "^2.9.0", | ||
"eslint-plugin-jest": "^21.13.0", | ||
"eslint-plugin-react": "^7.7.0" | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<meta name="theme-color" content="#000000"> | ||
<!-- | ||
manifest.json provides metadata used when your web app is added to the | ||
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"> | ||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>React App</title> | ||
</head> | ||
<body> | ||
<noscript> | ||
You need to enable JavaScript to run this app. | ||
</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"short_name": "React App", | ||
"name": "Create React App Sample", | ||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"type": "image/x-icon" | ||
} | ||
], | ||
"start_url": "./index.html", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import App from './App'; | ||
|
||
it('renders without crashing', () => { | ||
const div = document.createElement('div'); | ||
ReactDOM.render(<App />, div); | ||
ReactDOM.unmountComponentAtNode(div); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import { createStore, applyMiddleware } from 'redux'; | ||
import thunk from 'redux-thunk'; | ||
import { Provider } from 'react-redux'; | ||
import styled from 'styled-components'; | ||
|
||
import reducer from './reducer'; | ||
import { Header } from './Components'; | ||
import Game from './Game'; | ||
|
||
const store = createStore( | ||
reducer, | ||
applyMiddleware(thunk), | ||
); | ||
|
||
const Container = styled.div` | ||
font-family: sans-serif; | ||
`; | ||
|
||
export default function () { | ||
return ( | ||
<Provider store={store}> | ||
<Container className="App"> | ||
<Header /> | ||
<Game /> | ||
</Container> | ||
</Provider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
const Header = styled.header` | ||
background-color: #222; | ||
height: auto; | ||
padding: 20px; | ||
color: white; | ||
text-align: center; | ||
`; | ||
|
||
const Title = styled.h1` | ||
font-size: 1.5em; | ||
`; | ||
|
||
export default function () { | ||
return ( | ||
<Header className="App-header"> | ||
<Title>Save the Pony!</Title> | ||
</Header> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React, { PureComponent } from 'react'; | ||
import styled from 'styled-components'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const Background = styled.div` | ||
align-items: center; | ||
justify-content: center; | ||
display: flex; | ||
position: fixed; | ||
top: 0; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
background-color: rgba(0,0,0,0.3); | ||
padding: 50; | ||
text-align: center; | ||
`; | ||
|
||
const Container = styled.div` | ||
background-color: #fff; | ||
border-radius: 5; | ||
min-width: 200px; | ||
margin: 0px auto; | ||
padding: 30px; | ||
`; | ||
|
||
export default class Modal extends PureComponent { | ||
static propTypes = { | ||
children: PropTypes.node.isRequired, | ||
} | ||
|
||
render() { | ||
return ( | ||
<Background> | ||
<Container>{this.props.children}</Container> | ||
</Background> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as Header } from './Header'; | ||
export { default as Modal } from './Modal'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React, { PureComponent } from 'react'; | ||
import styled from 'styled-components'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import * as assets from './assets'; | ||
|
||
const StyledCell = styled.div` | ||
width: 1.5em; | ||
height: 1.5em; | ||
background-color: ${ | ||
({ hasGoal }) => { | ||
if (hasGoal) { return 'blue'; } | ||
return 'green'; | ||
} | ||
}; | ||
border-color: transparent; | ||
border-top-color: ${props => (props.north ? 'black' : 'transparent')}; | ||
border-left-color: ${props => (props.west ? 'black' : 'transparent')}; | ||
border-width: 0.18em; | ||
border-style: solid; | ||
`; | ||
|
||
const Icon = styled.img` | ||
max-height: 1.5em; | ||
max-width: 1.5em; | ||
`; | ||
|
||
export default class Cell extends PureComponent { | ||
static propTypes = { | ||
north: PropTypes.bool.isRequired, | ||
west: PropTypes.bool.isRequired, | ||
hasPony: PropTypes.bool.isRequired, | ||
hasDomokun: PropTypes.bool.isRequired, | ||
hasGoal: PropTypes.bool.isRequired, | ||
} | ||
|
||
render() { | ||
const { hasPony, hasDomokun, ...rest } = this.props; | ||
|
||
return ( | ||
<StyledCell {...rest}> | ||
{hasPony && <Icon src={assets.pony} />} | ||
{hasDomokun && <Icon src={assets.domokun} />} | ||
</StyledCell> | ||
); | ||
} | ||
} |
Oops, something went wrong.