├── .nvmrc ├── Procfile ├── .eslintignore ├── tests ├── config │ ├── jest │ │ ├── styleMock.js │ │ ├── fileMock.js │ │ ├── reactShim.js │ │ └── enzymeSetup.js │ ├── nightwatch │ │ ├── nightwatch-commands │ │ │ ├── safeClick.js │ │ │ ├── scrollElementToCenter.js │ │ │ ├── loadPage.js │ │ │ └── resizeTo.js │ │ ├── nightwatch-pages │ │ │ ├── home.js │ │ │ ├── global.js │ │ │ └── game.js │ │ ├── nightwatch-globals.js │ │ ├── nightwatch.conf.js │ │ └── nightwatch.json │ └── test-server │ │ └── test-server-entry.js ├── fixtures │ ├── public │ │ ├── app-fixtures.css │ │ ├── app-fixtures.js │ │ ├── vendor-fixtures.js │ │ └── polyfills-fixtures.js │ └── card-80.js ├── e2e │ ├── router.e2e.js │ ├── homepage.e2e.js │ └── game.e2e.js ├── README.md └── functional │ ├── routes │ ├── homepage-route.func.js │ └── game-route.func.js │ └── client-render.func.js ├── .npmignore ├── src ├── app │ ├── polyfills │ │ ├── fetch.js │ │ ├── promise.js │ │ ├── location.origin.js │ │ ├── node-fetch.js │ │ └── find.js │ ├── components │ │ ├── Loading │ │ │ └── Loading.jsx │ │ ├── NotFound │ │ │ ├── notFound-copy.js │ │ │ ├── NotFound.jsx │ │ │ └── NotFound.spec.jsx │ │ ├── Homepage │ │ │ ├── Homepage.spec.jsx │ │ │ └── Homepage.jsx │ │ ├── Error │ │ │ └── Error.jsx │ │ ├── Game │ │ │ ├── Game.spec.jsx │ │ │ ├── hand.js │ │ │ ├── Game.jsx │ │ │ └── hand.spec.js │ │ ├── Question │ │ │ └── Question.jsx │ │ └── Answer │ │ │ ├── Answer.spec.jsx │ │ │ └── Answer.jsx │ ├── Root.jsx │ ├── utils │ │ ├── randomRange.js │ │ ├── index.js │ │ ├── bem.js │ │ ├── fetch.js │ │ ├── fetch.spec.js │ │ ├── randomRange.spec.js │ │ ├── bem.md │ │ └── bem.spec.js │ ├── routes.spec.js │ ├── Layouts │ │ └── MainLayout.jsx │ └── routes.jsx ├── styles │ ├── app.scss │ ├── utils │ │ ├── _colours.scss │ │ ├── _breakpoints.scss │ │ └── _mixins.scss │ ├── components │ │ ├── answer.scss │ │ └── question.scss │ ├── base │ │ └── resets.scss │ └── layouts │ │ └── mainLayout.scss ├── polyfills.js ├── config │ ├── paths.js │ └── environment.js ├── client-entry.jsx ├── server-entry.js └── index.html ├── app.json ├── .gitignore ├── .editorconfig ├── .postcssrc ├── webpack.config.dev.js ├── webpack.config.prod.js ├── .babelrc ├── sass-lint.yml ├── .eslintrc ├── jest.json ├── LICENSE ├── circle.yml ├── webpack.common.js ├── CONTRIBUTING.md ├── package.json └── README.md /.nvmrc: -------------------------------------------------------------------------------- 1 | 9.3 2 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: npm start 2 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /tests/* 2 | src/**/*-copy.js 3 | -------------------------------------------------------------------------------- /tests/config/jest/styleMock.js: -------------------------------------------------------------------------------- 1 | module.exports = {} 2 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | node_modules/ 3 | .DS_Store 4 | .babelrc 5 | -------------------------------------------------------------------------------- /tests/config/jest/fileMock.js: -------------------------------------------------------------------------------- 1 | module.exports = 'test-file-stub' 2 | -------------------------------------------------------------------------------- /src/app/polyfills/fetch.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | // for ie 3 | require('whatwg-fetch') 4 | -------------------------------------------------------------------------------- /tests/config/jest/reactShim.js: -------------------------------------------------------------------------------- 1 | global.requestAnimationFrame = (callback) => { 2 | setTimeout(callback, 0) 3 | } 4 | -------------------------------------------------------------------------------- /src/styles/app.scss: -------------------------------------------------------------------------------- 1 | @import "base/resets"; 2 | 3 | @import "layouts/mainLayout"; 4 | 5 | @import "components/answer"; 6 | @import "components/question"; 7 | -------------------------------------------------------------------------------- /src/styles/utils/_colours.scss: -------------------------------------------------------------------------------- 1 | $item-color: #d3d3d3; 2 | $item-color--correct: #006400; 3 | $item-color--wrong: #ff0000; 4 | $item-color--selected: #0b97c4; 5 | -------------------------------------------------------------------------------- /src/app/components/Loading/Loading.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Loading = () =>
Loading hand....
; 4 | 5 | export default Loading; 6 | -------------------------------------------------------------------------------- /src/polyfills.js: -------------------------------------------------------------------------------- 1 | require('./app/polyfills/fetch'); 2 | require('./app/polyfills/find'); 3 | require('./app/polyfills/location.origin'); 4 | require('./app/polyfills/promise'); 5 | -------------------------------------------------------------------------------- /src/app/polyfills/promise.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | // for ie 3 | var Promise = require('promise-polyfill'); 4 | 5 | if (!window.Promise) { 6 | window.Promise = Promise; 7 | } 8 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-lego", 3 | "scripts": { 4 | }, 5 | "env": { 6 | "NODE_ENV": { 7 | "required": true 8 | } 9 | }, 10 | "addons": [ 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /tests/config/jest/enzymeSetup.js: -------------------------------------------------------------------------------- 1 | import { configure } from 'enzyme' 2 | import Adapter from 'enzyme-adapter-react-16' 3 | 4 | configure({ adapter: new Adapter() }) 5 | 6 | require('../../../src/app/polyfills/node-fetch'); 7 | -------------------------------------------------------------------------------- /tests/fixtures/public/app-fixtures.css: -------------------------------------------------------------------------------- 1 | * { 2 | border: 9px solid pink; 3 | } 4 | * { 5 | border: 9px solid pink; 6 | } 7 | * { 8 | border: 9px solid pink; 9 | } 10 | * { 11 | border: 9px solid pink; 12 | } 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules/ 3 | dist/ 4 | compiled/ 5 | tests/coverage/ 6 | tests_output/ 7 | tests_screenshots/ 8 | .DS_Store 9 | .swp 10 | .divshot-cache 11 | *.iml 12 | *.log 13 | webpack-assets.json 14 | webpack-stats.json 15 | -------------------------------------------------------------------------------- /src/app/polyfills/location.origin.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | // for ie 3 | if (!window.location.origin) { 4 | var local = window.location; 5 | window.location.origin = local.protocol + '//' + local.hostname + ( 6 | local.port ? (':' + local.port) : '' 7 | ); 8 | } 9 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | charset = utf-8 11 | indent_style = space 12 | indent_size = 2 13 | trim_trailing_whitespace = true 14 | -------------------------------------------------------------------------------- /tests/config/nightwatch/nightwatch-commands/safeClick.js: -------------------------------------------------------------------------------- 1 | exports.command = function safeClick(selector, callback) { 2 | var browser = this; 3 | 4 | browser 5 | .waitForElementPresent(selector) 6 | .scrollElementToCenter(selector) 7 | .click(selector, function(){ 8 | if (typeof callback === 'function') { 9 | callback.call(browser); 10 | } 11 | }) 12 | 13 | return this; 14 | }; 15 | -------------------------------------------------------------------------------- /.postcssrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": { 3 | "autoprefixer": { 4 | browsers: [ 5 | 'Safari >= 8', 6 | 'ie >= 10', 7 | 'last 2 Chrome versions', 8 | 'last 2 Firefox versions', 9 | 'Edge >= 13', 10 | 'ios_saf >= 8', 11 | 'ie_mob >= 11', 12 | 'Android >= 4' 13 | ], 14 | cascade: false, 15 | add: true, 16 | remove: true 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/app/components/NotFound/notFound-copy.js: -------------------------------------------------------------------------------- 1 | export const copy = { 2 | title: `How did you end up here?`, 3 | blurb: `The page you're looking for doesn't exist.`, 4 | try: { 5 | blurb: `A couple of things you can try:`, 6 | options: [ 7 | `Did you type in a web address to get here? Check you typed it in correctly.`, 8 | `Try to find the page you were looking for by clicking My Account.` 9 | ] 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/app/components/Homepage/Homepage.spec.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { shallow } from 'enzyme'; 3 | 4 | import Homepage from './Homepage'; 5 | 6 | const baseProps = {}; 7 | 8 | describe('Settings Container', () => { 9 | it('should have an id of homepage', () => { 10 | const wrapper = shallow({copy.blurb}
8 | 16 |8 | {String(error)} needs to be handled, was not a string 9 |
10 | ); 11 | } 12 | returnError Loading cards!{error}
; 13 | }; 14 | 15 | Error.propTypes = { 16 | error: PropTypes.string.isRequired 17 | }; 18 | 19 | export default Error; 20 | -------------------------------------------------------------------------------- /src/app/utils/randomRange.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export function randomRange(from, to, length) { 3 | if (to < from) return []; 4 | const returnArray = []; 5 | let loopCount = 0; 6 | randomRangeLoop: 7 | while (loopCount < length) { 8 | const randomInt = Math.floor(Math.random() * (to - from + 1)) + from; 9 | let i = 0; 10 | while (i < loopCount) { 11 | if (returnArray[i++] === randomInt) continue randomRangeLoop; 12 | } 13 | returnArray[loopCount++] = randomInt; 14 | } 15 | return returnArray; 16 | } 17 | -------------------------------------------------------------------------------- /src/styles/components/answer.scss: -------------------------------------------------------------------------------- 1 | @import '../utils/colours'; 2 | 3 | .answer-option { 4 | width: 49%; 5 | float: left; 6 | margin-right: 1%; 7 | padding: 1%; 8 | border: 1px dashed $item-color; 9 | 10 | &--answer { 11 | border: 2px solid $item-color--correct; 12 | } 13 | 14 | &__title { 15 | font-weight: bold; 16 | display: inline-block; 17 | width: 40%; 18 | min-width: 100px; 19 | } 20 | 21 | &__value { 22 | display: inline-block; 23 | width: 60%; 24 | margin: 0; 25 | min-width: 150px; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/styles/components/question.scss: -------------------------------------------------------------------------------- 1 | @import '../utils/colours'; 2 | 3 | .card-item-value { 4 | display: block; 5 | } 6 | 7 | .question__options { 8 | padding: 0; 9 | } 10 | 11 | .question__option { 12 | display: block; 13 | border: 1px dashed $item-color; 14 | padding: 4px; 15 | margin: 4px; 16 | cursor: pointer; 17 | 18 | &--selected { 19 | border: 2px solid $item-color--selected; 20 | } 21 | 22 | &--wrong { 23 | border-color: $item-color--wrong; 24 | } 25 | 26 | &--correct { 27 | border-color: $item-color--correct; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/client-entry.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import debug from 'debug'; 4 | 5 | import './config/environment'; 6 | 7 | import Root from './app/Root'; 8 | 9 | const log = debug('lego:client-entry'); 10 | 11 | try { 12 | ReactDOM.render(Iteratively add more technologies to React Applications.
11 |This demo is the ‘base’ app, which includes :
15 |This app isn't aimed to be the simplest ‘base’ React app, 29 | it's aimed at adding new technologies simple. 30 |
31 |But, this means that when it comes to adding Redux for example, 32 | much less changes are required. 33 |
34 |{children}
43 |A simple game using {config.api.label}.
85 |