diff --git a/README.md b/README.md index 58beeac..2625982 100644 --- a/README.md +++ b/README.md @@ -1,70 +1,9 @@ -# Getting Started with Create React App +# FeedBack APP +--- +>Simple App that has a single for that has a rating and a review field. It works +with local database as file and uses json-server as back end +--- +## Usage: -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 your browser. - -The page will reload when you make changes.\ -You may 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/). - -### Code Splitting - -This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) - -### Analyzing the Bundle Size - -This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) - -### Making a Progressive Web App - -This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) - -### Advanced Configuration - -This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) - -### Deployment - -This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) - -### `npm run build` fails to minify - -This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) +`npm run sever` +`npm start` diff --git a/db.json b/db.json index 0d8deb1..e520621 100644 --- a/db.json +++ b/db.json @@ -1,19 +1,19 @@ { - "feedback":[ - { - "id":3, - "rating":10, - "text":"This is feedback item 3 comfing from the backend" - }, - { - "id":2, - "rating":10, - "text":"This is feedback item 2 comfing from the backend" - }, - { - "id":1, - "rating":10, - "text":"This is feedback item 1 comfing from the backend" - } - ] -} + "feedback": [ + { + "id": 3, + "rating": 10, + "text": "This is feedback item 3 comfing from the backend" + }, + { + "id": 2, + "rating": 10, + "text": "This is feedback item 2 comfing from the backend" + }, + { + "id": 1, + "rating": 10, + "text": "This is feedback item 1 comfing from the backend" + } + ] +} \ No newline at end of file diff --git a/package.json b/package.json index 0dbce7a..6bbd51d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "feed-app", "version": "0.1.0", "private": true, - "proxy":"http://localhost:5000", + "proxy": "http://localhost:4000", "dependencies": { "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", @@ -22,7 +22,7 @@ "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", - "server": "json-server --watch db.json --port 5000", + "server": "json-server --watch db.json --port 4000", "dev": "concurrently \"npm run server\" \"npm start\"" }, "eslintConfig": { diff --git a/src/components/FeedbackForm.jsx b/src/components/FeedbackForm.jsx index ea0c324..9d714e2 100644 --- a/src/components/FeedbackForm.jsx +++ b/src/components/FeedbackForm.jsx @@ -21,18 +21,18 @@ function FeedbackForm() { } }, [feedbackEdit]); - const handleTextChange = ({target:{value}}) => { + const handleTextChange = ({ target: { value } }) => { if (value === "") { setBtnDisabled(true); setMessage(null); - } else if (value.trim().length<10){ + } else if (value.trim().length < 10) { setMessage("Text must be at least 10 characters"); setBtnDisabled(true); } else { setMessage(null); setBtnDisabled(false); } - setText(value) + setText(value); }; const handleSubmit = (e) => { @@ -42,6 +42,7 @@ function FeedbackForm() { text, rating, }; + console.log(newFeedback); if (feedbackEdit.edit === true) { updateFeedback(feedbackEdit.item.id, newFeedback); } else { diff --git a/src/components/shared/AboutIconLink.jsx b/src/components/shared/AboutIconLink.jsx index 02439b5..aec3aff 100644 --- a/src/components/shared/AboutIconLink.jsx +++ b/src/components/shared/AboutIconLink.jsx @@ -1,5 +1,6 @@ import { Link } from "react-router-dom"; import { FaQuestion } from "react-icons/fa"; + function AboutIconLink() { return (