diff --git a/original-24/.babelrc b/original-24/.babelrc new file mode 100644 index 0000000..86c445f --- /dev/null +++ b/original-24/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015", "react"] +} diff --git a/original-24/.eslintrc b/original-24/.eslintrc new file mode 100644 index 0000000..8dc6807 --- /dev/null +++ b/original-24/.eslintrc @@ -0,0 +1,21 @@ +{ + "rules": { + "no-console": "off", + "indent": [ "error", 2 ], + "quotes": [ "error", "single" ], + "semi": ["error", "always"], + "linebreak-style": [ "error", "unix" ] + }, + "env": { + "es6": true, + "node": true, + "mocha": true, + "jasmine": true + }, + "ecmaFeatures": { + "modules": true, + "experimentalObjectRestSpread": true, + "impliedStrict": true + }, + "extends": "eslint:recommended" +} diff --git a/original-24/.gitignore b/original-24/.gitignore new file mode 100644 index 0000000..57bad08 --- /dev/null +++ b/original-24/.gitignore @@ -0,0 +1,70 @@ +# Created by https://www.gitignore.io/api/osx,linux,node,vim +node_modules +.env +.test.env +db/ +build/ + +.DS_Store +.AppleDouble +.LSOverride + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + + +### Node ### +# Logs +logs +*.log +npm-debug.log* +.tern-project + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules +jspm_packages + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history + +### Vim ### +# swap +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +# session +Session.vim +# temporary +.netrwhist +*~ + +# auto-generated tag files +tags diff --git a/original-24/README.md b/original-24/README.md new file mode 100644 index 0000000..e69de29 diff --git a/original-24/package.json b/original-24/package.json new file mode 100644 index 0000000..5a0f16c --- /dev/null +++ b/original-24/package.json @@ -0,0 +1,38 @@ +{ + "name": "23-components_and_routing", + "version": "1.0.0", + "description": " 23: Components and Routing ======", + "main": "index.js", + "scripts": { + "build": "webpack", + "watch": "webpack-dev-server --inline --hot" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/nickjaz/23-components_and_routing.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/nickjaz/23-components_and_routing/issues" + }, + "homepage": "https://github.com/nickjaz/23-components_and_routing#readme", + "dependencies": { + "babel-core": "^6.26.0", + "babel-loader": "^7.1.2", + "babel-preset-es2015": "^6.24.1", + "babel-preset-react": "^6.24.1", + "css-loader": "^0.28.5", + "extract-text-webpack-plugin": "^3.0.0", + "html-webpack-plugin": "^2.30.1", + "node-sass": "^4.5.3", + "react": "^15.6.1", + "react-dom": "^15.6.1", + "react-router-dom": "^4.1.2", + "sass-loader": "^6.0.6", + "uuid": "^3.1.0", + "webpack": "^3.5.5", + "webpack-dev-server": "^2.7.1" + } +} diff --git a/original-24/src/.babelrc b/original-24/src/.babelrc new file mode 100644 index 0000000..86c445f --- /dev/null +++ b/original-24/src/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015", "react"] +} diff --git a/original-24/src/.eslintrc b/original-24/src/.eslintrc new file mode 100644 index 0000000..8dc6807 --- /dev/null +++ b/original-24/src/.eslintrc @@ -0,0 +1,21 @@ +{ + "rules": { + "no-console": "off", + "indent": [ "error", 2 ], + "quotes": [ "error", "single" ], + "semi": ["error", "always"], + "linebreak-style": [ "error", "unix" ] + }, + "env": { + "es6": true, + "node": true, + "mocha": true, + "jasmine": true + }, + "ecmaFeatures": { + "modules": true, + "experimentalObjectRestSpread": true, + "impliedStrict": true + }, + "extends": "eslint:recommended" +} diff --git a/original-24/src/.gitignore b/original-24/src/.gitignore new file mode 100644 index 0000000..57bad08 --- /dev/null +++ b/original-24/src/.gitignore @@ -0,0 +1,70 @@ +# Created by https://www.gitignore.io/api/osx,linux,node,vim +node_modules +.env +.test.env +db/ +build/ + +.DS_Store +.AppleDouble +.LSOverride + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + + +### Node ### +# Logs +logs +*.log +npm-debug.log* +.tern-project + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules +jspm_packages + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history + +### Vim ### +# swap +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +# session +Session.vim +# temporary +.netrwhist +*~ + +# auto-generated tag files +tags diff --git a/original-24/src/component/note-container/index.js b/original-24/src/component/note-container/index.js new file mode 100644 index 0000000..127229e --- /dev/null +++ b/original-24/src/component/note-container/index.js @@ -0,0 +1,60 @@ +import React from 'react'; +import uuid from 'uuid/v1'; + +import NoteCreateForm from '../note-create-form'; +import NoteList from '../note-list' + +class NoteContainer extends React.Component { + constructor(props) { + super(props); + this.noteCreate = this.noteCreate.bind(this); + this.noteRemove = this.noteRemove.bind(this); + this.noteUpdate = this.noteUpdate.bind(this); + } + + noteCreate(note) { + note.id = uuid(); + this.props.app.setState(state => ({ + notes: [...state.notes, note] + })); + } + + noteRemove(note) { + let {app} = this.props; + app.setState(prevState => ({ + notes: prevState.notes.filter((item) => { + return item.id !==note.id + }) + })); + } + + noteUpdate(note) { + let{app} = this.props; + app.setState(prevState => ({ + notes: prevState.notes.map((item) =>{ + return item.id === note.id ? note : item; + }) + })); + } + + render() { + let {app} =this.props; + + return ( + +
add a note
+{item.content}
+