Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ae8a946

Browse files
Jean RauwersJean Rauwers
Jean Rauwers
authored and
Jean Rauwers
committed
Demo project for Todo List
1 parent ec41ebd commit ae8a946

File tree

9 files changed

+30
-30
lines changed

9 files changed

+30
-30
lines changed

‎README.md‎

-2.74 KB
(削除)

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/). ### Code Splitting This section has moved here: 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 ### Making a Progressive Web App This section has moved here: 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 ### Deployment This section has moved here: 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 # React-todo-demo

(削除ここまで)
(追記)

React Todo List example.

(追記ここまで)
(追記)

This is a demo project.

(追記ここまで)
(追記)

start - npm run start test - npm run test build - npm run build

(追記ここまで)

‎public/index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
work correctly both with client-side routing and a non-root public URL.
2323
Learn how to configure a non-root public URL by running `npm run build`.
2424
-->
25-
<title>React App</title>
25+
<title>React demo</title>
2626
</head>
2727
<body>
2828
<noscript>You need to enable JavaScript to run this app.</noscript>

‎src/App.css‎ renamed to ‎src/Components/App/App.css‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ body {
2828
}
2929
/* The note */
3030
.note {
31-
color: darkblue;
31+
color: #0074cc;
3232
padding: 40px;
3333
margin: 20px;
3434
background: #fff;
@@ -56,7 +56,7 @@ body {
5656
font-size: 28px;
5757
font-weight: bold;
5858
color: #f1f1f1;
59-
background: #7fba23;
59+
background: #0074cc;
6060
cursor: pointer;
6161
box-shadow: 0px 0px 11px 0px rgba(0,0,0,0.8);
6262
-webkit-box-shadow: 0px 0px 11px 0px rgba(0,0,0,0.8);

‎src/App.js‎ renamed to ‎src/Components/App/App.jsx‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { Component } from 'react';
22
import './App.css';
3-
import Note from './Note';
3+
import Note from '../Note/Note';
4+
45
class App extends Component {
56
constructor(props) {
67
super(props);
@@ -9,18 +10,21 @@ class App extends Component {
910
notes: []
1011
};
1112
this.delete = this.delete.bind(this);
13+
this.handleKeyPress = this.handleKeyPress.bind(this);
14+
this.addNote = this.addNote.bind(this);
1215
}
1316
updateNoteText(noteText) {
1417
this.setState({ inputValue: noteText.target.value });
1518
}
1619

1720
handleKeyPress(e) {
1821
if (e.key === 'Enter') {
22+
this.addNote()
1923
}
2024
}
2125

2226
addNote() {
23-
if (this.state.value === '' || this.state.value === ' ') {
27+
if (this.state.inputValue === '' || this.state.inputValue === ' ') {
2428
return 0;
2529
}
2630

@@ -39,7 +43,7 @@ class App extends Component {
3943
createTasks(item) {
4044
return (
4145
<div className="note" key={item}>
42-
{item.value==='' ? '' : item}
46+
{item ? item : ''}
4347
</div>
4448
);
4549
}
@@ -50,8 +54,8 @@ class App extends Component {
5054

5155
return (
5256
<div className="container">
53-
<div className="header">TODO App</div>
54-
<div className="btn" onClick={this.addNote.bind(this)}>
57+
<div className="header">React - TODO List Demo</div>
58+
<div className="btn" onClick={this.addNote}>
5559
+
5660
</div>
5761
<input
@@ -60,7 +64,7 @@ class App extends Component {
6064
ref={input => (this.textinput = input)}
6165
value={this.state.inputValue}
6266
onChange={noteText => this.updateNoteText(noteText)}
63-
onKeyPress={this.handleKeyPress.bind(this)}
67+
onKeyPress={this.handleKeyPress}
6468
/>
6569
<Note item={notes} delete={this.delete} state={this.state.notes} />
6670
</div>

‎src/App.test.js‎ renamed to ‎src/Components/App/App.test.js‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import ReactDOM from 'react-dom';
33
import App from './App';
44

55
it('renders without crashing', () => {
6-
const div = document.createElement('div');
7-
ReactDOM.render(<App />, div);
8-
ReactDOM.unmountComponentAtNode(div);
6+
const div = document.createElement('div');
7+
ReactDOM.render(<App />, div);
8+
ReactDOM.unmountComponentAtNode(div);
99
});
10+
11+

‎src/Note.jsx‎ renamed to ‎src/Components/Note/Note.jsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const Note = props => {
66
return (
77
<div
88
className="listItem"
9-
key={item.key}
9+
key={item ? item : ''}
1010
onClick={() => props.delete(item)}
1111
>
12-
{item.value==='' ? '' : item}
12+
{item ? item : ''}
1313
</div>
1414
);
1515
};

‎src/Components/Note/Note.test.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import Note from './Note';
4+
5+
it('renders without crashing', () => {
6+
const div = document.createElement('div');
7+
ReactDOM.render(<Note />, div);
8+
ReactDOM.unmountComponentAtNode(div);
9+
});

‎src/index.css‎

Lines changed: 0 additions & 14 deletions
This file was deleted.

‎src/index.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import './index.css';
4-
import App from './App';
3+
import App from './Components/App/App';
54
import * as serviceWorker from './serviceWorker';
65

76
ReactDOM.render(<App />, document.getElementById('root'));

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /