diff --git a/README.md b/README.md index 34ed423ce3..5a538c5001 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,12 @@ Upon your first commit, please submit a Pull Request and add _both_ the **Trello - [ ] Share your board with the project manager that has been assigned to you. If you have not been assigned yet, reach out to your lead PM for guidance - [ ] Add your Trello URL to your project's README.md file. Commit the change, push it to your repository & submit a pull request + +https://trello.com/b/k3DrISf6/lambda-notes-phil + + + + ## MVP Features: - [ ] Display a list of notes diff --git a/node_modules/.yarn-integrity b/node_modules/.yarn-integrity new file mode 100644 index 0000000000..02fe3e7acc --- /dev/null +++ b/node_modules/.yarn-integrity @@ -0,0 +1,10 @@ +{ + "systemParams": "darwin-x64-64", + "modulesFolders": [], + "flags": [], + "linkedModules": [], + "topLevelPatterns": [], + "lockfileEntries": {}, + "files": [], + "artifacts": {} +} \ No newline at end of file diff --git a/notes/.gitignore b/notes/.gitignore new file mode 100644 index 0000000000..4d29575de8 --- /dev/null +++ b/notes/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# 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* diff --git a/notes/README.md b/notes/README.md new file mode 100644 index 0000000000..897dc83660 --- /dev/null +++ b/notes/README.md @@ -0,0 +1,44 @@ +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + +## Available Scripts + +In the project directory, you can run: + +### `npm start` + +Runs the app in the development mode.
+Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.
+You will also see any lint errors in the console. + +### `npm test` + +Launches the test runner in the interactive watch mode.
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. + +### `npm run build` + +Builds the app for production to the `build` folder.
+It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.
+Your app is ready to be deployed! + +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. + +### `npm run eject` + +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** + +If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. + +Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. + +You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. + +## Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). diff --git a/notes/package.json b/notes/package.json new file mode 100644 index 0000000000..e0f74cfa7c --- /dev/null +++ b/notes/package.json @@ -0,0 +1,30 @@ +{ + "name": "notes", + "version": "0.1.0", + "private": true, + "dependencies": { + "axios": "^0.18.0", + "react": "^16.6.0", + "react-dom": "^16.6.0", + "react-markdown": "^4.0.3", + "react-modal": "^3.6.1", + "react-pose": "^4.0.1", + "react-router-dom": "^4.3.1", + "react-scripts": "2.1.1" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": "react-app" + }, + "browserslist": [ + ">0.2%", + "not dead", + "not ie <= 11", + "not op_mini all" + ] +} diff --git a/notes/public/favicon.ico b/notes/public/favicon.ico new file mode 100644 index 0000000000..a11777cc47 Binary files /dev/null and b/notes/public/favicon.ico differ diff --git a/notes/public/index.html b/notes/public/index.html new file mode 100644 index 0000000000..4bfce95684 --- /dev/null +++ b/notes/public/index.html @@ -0,0 +1,40 @@ + + + + + + + + + + + React App + + + +
+ + + diff --git a/notes/public/manifest.json b/notes/public/manifest.json new file mode 100644 index 0000000000..1f2f141faf --- /dev/null +++ b/notes/public/manifest.json @@ -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": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/notes/src/App.css b/notes/src/App.css new file mode 100644 index 0000000000..599077437d --- /dev/null +++ b/notes/src/App.css @@ -0,0 +1,212 @@ +* { + box-sizing: border-box; + max-width: 1000px; + margin: 0 auto; +} + +.App { + display: flex; + height: 100%; +} + +.side-bar { + width: 200px; + height: 1300px; + text-align: center; + background: lightgrey; +} + +.side-button { + height: 35px; + width: 90%; + text-align: center; + color: white; + background: #24b8bd; + margin: 5px 0; +} + +h2 { + background: #F2f1f2; + +} + + +.note { + height: 185px; + border: 2px solid lightgrey; + width: 160px; + margin: 5px; + background: #FFFFFF; +} + +.cont-body { + display: flex; + flex-wrap: wrap; + background: #F2f1f2; + height: 1275px; +} + +.note-title { + border-bottom: 2px solid lightgrey; + width: 100%; + text-align: center; + color: black; + font-weight: bold; + text-decoration: none; +} + + +.note-body { + width: 65%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + +} + +.form-button { + text-decoration: none; + font-size: 10px; + background-color: #35c0c3; + height: 32px; + width: 143px; + color: white; + display: flex; + justify-content: center; + align-items: center; + font-weight: bold; + border: 1px solid #94a3a4; + margin-left: 10px; + margin-top: 20px; + margin-bottom: 20px; +} + +.form-button:hover { + background-color: white; + color: #24b8bd; +} + +.new-note-container { + display: flex; + flex-direction: column; + +} + +.notes-header { + width: 100%; + margin-top: 50px; + margin-left: 10px; +} + +form { + flex-direction: column; + display: flex; +} + +.form-note-title { + width: 300px; + margin: 20px 0; + margin-left: 10px; + border-radius: 2px; + border: 1px solid #94a3a4; + height: 40px; +} + +.form-note-content { + width: 650px; + margin-left: 10px; + height: 300px; + border-radius: 2px; + border: 1px solid #94a3a4; +} + +.note-card-container { + display: flex; + flex-wrap: wrap; + justify-content: space-between; +} + + + + + + + +.modal { + display: flex; + align-items: center; + justify-content: center; + height: 300px; + flex-direction: column; +} + +.modal-prompt { + font-size: 12px; + font-weight: bold; +} + +.modal-button-container { + display: flex; + flex-direction: row; + width: 300px; + justify-content: space-between; +} + +.modal-delete-button { + text-decoration: none; + font-size: 10px; + background-color: #c30019; + height: 32px; + width: 143px; + color: white; + display: flex; + justify-content: center; + align-items: center; + font-weight: bold; + border: 1px solid #94a3a4; + margin-bottom: 20px; +} + +.modal-delete-button:hover { + color: #c30019; + background-color: white; +} + +.modal-no-button { + text-decoration: none; + font-size: 10px; + background-color: #35c0c3; + height: 32px; + width: 143px; + color: white; + display: flex; + justify-content: center; + align-items: center; + font-weight: bold; + border: 1px solid #94a3a4; + margin-bottom: 20px; +} + +.modal-no-button:hover { + color: #35c0c3; + background-color: white; +} + +.edit-delete-container { + display: flex; + flex-direction: row; + justify-content: space-evenly; + text-decoration: none; +} + +.edit-note-link { + border-bottom: 1px solid black; + cursor: pointer; +} + + +.delete-note-link { + border-bottom: 1px solid black; + cursor: pointer; + margin-right: 10px; +} \ No newline at end of file diff --git a/notes/src/App.js b/notes/src/App.js new file mode 100644 index 0000000000..aac82ac8f5 --- /dev/null +++ b/notes/src/App.js @@ -0,0 +1,112 @@ +import React, { Component } from 'react'; +import "./App.css"; +import axios from "axios"; +import NoteForm from "./components/NoteForm" +import EditNote from "./components/EditNote" +import Note from "./components/Note" +import NoteList from "./components/NoteList" +import SearchBar from './components/SearchBar'; +import { Route, NavLink, withRouter } from "react-router-dom"; + +class App extends Component { +constructor() { + super(); + this.state = { + notes: [], + filterednotes: [] + + } +} + +componentDidMount() { + axios + .get("http://localhost:7000/api/notes") + .then(response => this.setState({ notes: response.data })) + .catch(error => console.log(error)) +} + +addNote = (event, newNote) => { + event.preventDefault(); + axios + .post("http://localhost:7000/api/notes", newNote) + .then(response => { + newNote.id = response.data.success; + this.setState({ notes: [newNote, ...this.state.notes] }) + }) + .catch(error => console.log(error)) +} + + +editNote = (event, id, state) => { + event.preventDefault(); + console.log(id) + axios + .put(`http://localhost:7000/api/notes/${id}`, state) + .then(response => { + const updateArray = this.state.notes.map(note => { + if (note.id === response.data.id) { + return response.data; + } + return note; + }); + console.log(updateArray) + this.setState({ notes: updateArray }); + }) + .catch(error => console.log(error)); +} + +searchNotes = event => { + const narrowedNotes = this.state.notes.filter(note => { + if (note.title.textbody.includes(event.target.value)) { + return note + } + }) + this.setState({ filteredNotes: narrowedNotes }) +} + + + + render() { + return ( +
+
+
+
+

Lambda

+

Notes

+
+ + + + + + + +
+ ( + + + )} + /> + {/*
*/} + } /> + } /> + } /> +
+ + ); + } +} + + + + + + + +export default withRouter(App); diff --git a/notes/src/App.test.js b/notes/src/App.test.js new file mode 100644 index 0000000000..a754b201bf --- /dev/null +++ b/notes/src/App.test.js @@ -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(, div); + ReactDOM.unmountComponentAtNode(div); +}); diff --git a/notes/src/components/EditNote.js b/notes/src/components/EditNote.js new file mode 100644 index 0000000000..e25ec1c6bf --- /dev/null +++ b/notes/src/components/EditNote.js @@ -0,0 +1,83 @@ +import React, { Component } from "react"; +import axios from "axios"; + +class EditNote extends Component { + constructor(props) { + super(props); + this.state = { + title: "", + textBody: "", + note: [] + + } + } + + componentDidMount() { + const id = this.props.match.params.id; + this.getNote(id); + } + + + getNote = id => { + axios + .get(`http://localhost:7000/api/notes/${id}`) + .then(response => this.setState({ note: response.data })) + .catch(response => console.log(response)); + } + + changeHandler = event => { + this.setState({ [event.target.name]: event.target.value }); + }; + + + + + submitNote = event => { + const editedNote = { + title: this.state.title, + textBody: this.state.textBody + } + this.props.editNote(event, this.props.match.params.id, editedNote); + this.setState({ title: "", textBody: "" }) + this.props.history.push("/") + console.log('hello') + } + + + + + render() { + return ( +
+
+

Edit Notee:

+
+
+ +