-
Notifications
You must be signed in to change notification settings - Fork 12
Angga Prasetya Wibawa #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
anggapw
wants to merge
6
commits into
Excellent-Echo:main
Choose a base branch
from
anggapw:dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "semi": false, | ||
| "trailingComma": "none", | ||
| "tabWidth": 4, | ||
| "singleQuote": true, | ||
| "printWidth": 140 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,4 @@ | ||
| # todo-list-application | ||
| # todo-list-application | ||
|
|
||
| ## URL | ||
| [To Do List React](https://todolist-react-anggapw.netlify.app/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| { | ||
| "name": "todolist-react", | ||
| "version": "0.1.0", | ||
| "private": true, | ||
| "dependencies": { | ||
| "@testing-library/jest-dom": "^5.11.4", | ||
| "@testing-library/react": "^11.1.0", | ||
| "@testing-library/user-event": "^12.1.10", | ||
| "bootstrap": "^4.6.0", | ||
| "react": "^17.0.2", | ||
| "react-dom": "^17.0.2", | ||
| "react-scripts": "4.0.3", | ||
| "reactstrap": "^8.9.0", | ||
| "web-vitals": "^1.0.1" | ||
| }, | ||
| "scripts": { | ||
| "start": "BROWSER='google-chrome-stable' react-scripts start", | ||
| "build": "react-scripts build", | ||
| "test": "react-scripts test", | ||
| "eject": "react-scripts eject" | ||
| }, | ||
| "eslintConfig": { | ||
| "extends": [ | ||
| "react-app", | ||
| "react-app/jest" | ||
| ] | ||
| }, | ||
| "browserslist": { | ||
| "production": [ | ||
| ">0.2%", | ||
| "not dead", | ||
| "not op_mini all" | ||
| ], | ||
| "development": [ | ||
| "last 1 chrome version", | ||
| "last 1 firefox version", | ||
| "last 1 safari version" | ||
| ] | ||
| } | ||
| } |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| <meta name="theme-color" content="#000000" /> | ||
| <meta name="description" content="Web site created using create-react-app" /> | ||
| <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
| <!-- | ||
| manifest.json provides metadata used when your web app is installed on a | ||
| user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | ||
| --> | ||
| <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
| <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" /> | ||
| <!-- | ||
| Notice the use of %PUBLIC_URL% in the tags above. | ||
| It will be replaced with the URL of the `public` folder during the build. | ||
| Only files inside the `public` folder can be referenced from the HTML. | ||
|
|
||
| Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
| work correctly both with client-side routing and a non-root public URL. | ||
| Learn how to configure a non-root public URL by running `npm run build`. | ||
| --> | ||
| <title>React App</title> | ||
| </head> | ||
| <body> | ||
| <noscript>You need to enable JavaScript to run this app.</noscript> | ||
| <div id="root"></div> | ||
| <!-- | ||
| This HTML file is a template. | ||
| If you open it directly in the browser, you will see an empty page. | ||
|
|
||
| You can add webfonts, meta tags, or analytics to this file. | ||
| The build step will place the bundled scripts into the <body> tag. | ||
|
|
||
| To begin the development, run `npm start` or `yarn start`. | ||
| To create a production bundle, use `npm run build` or `yarn build`. | ||
| --></body> | ||
|
|
||
| <script src="https://kit.fontawesome.com/6645177271.js" crossorigin="anonymous"></script> | ||
| </html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "short_name": "React App", | ||
| "name": "Create React App Sample", | ||
| "icons": [ | ||
| { | ||
| "src": "favicon.ico", | ||
| "sizes": "64x64 32x32 24x24 16x16", | ||
| "type": "image/x-icon" | ||
| }, | ||
| { | ||
| "src": "logo192.png", | ||
| "type": "image/png", | ||
| "sizes": "192x192" | ||
| }, | ||
| { | ||
| "src": "logo512.png", | ||
| "type": "image/png", | ||
| "sizes": "512x512" | ||
| } | ||
| ], | ||
| "start_url": ".", | ||
| "display": "standalone", | ||
| "theme_color": "#000000", | ||
| "background_color": "#ffffff" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # https://www.robotstxt.org/robotstxt.html | ||
| User-agent: * | ||
| Disallow: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| /* .App { | ||
| text-align: center; | ||
| } | ||
|
|
||
| .App-logo { | ||
| height: 40vmin; | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| @media (prefers-reduced-motion: no-preference) { | ||
| .App-logo { | ||
| animation: App-logo-spin infinite 20s linear; | ||
| } | ||
| } | ||
|
|
||
| .App-header { | ||
| background-color: #282c34; | ||
| min-height: 100vh; | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| justify-content: center; | ||
| font-size: calc(10px + 2vmin); | ||
| color: white; | ||
| } | ||
|
|
||
| .App-link { | ||
| color: #61dafb; | ||
| } | ||
|
|
||
| @keyframes App-logo-spin { | ||
| from { | ||
| transform: rotate(0deg); | ||
| } | ||
| to { | ||
| transform: rotate(360deg); | ||
| } | ||
| } | ||
|
|
||
| .Input-data { | ||
| display: flex; | ||
| justify-content: center; | ||
| } */ | ||
|
|
||
| /* body{ | ||
| background: rgb(255, 173, 65); | ||
| } | ||
|
|
||
| .todo-container{ | ||
| background: rgb(41, 33, 33); | ||
| width: 40vw; | ||
| margin: 10em auto; | ||
| border-radius: 15px; | ||
| padding: 20px 10px; | ||
| color: white; | ||
| border: 3px solid rgb(36, 110, 194); | ||
| } | ||
|
|
||
| .task{ | ||
| border: 1px solid white; | ||
| border-radius: 5px; | ||
| padding: 0.5em; | ||
| margin: 0.5em; | ||
| } | ||
|
|
||
| .task button{ | ||
| background: rgb(12, 124, 251); | ||
| border-radius: 5px; | ||
| margin: 0px 5px; | ||
| padding: 3px 5px; | ||
| border: none; | ||
| cursor: pointer; | ||
| color: white; | ||
| float: right; | ||
| } | ||
|
|
||
| .header{ | ||
| margin: 0.5em; | ||
| font-size: 2em; | ||
| text-align: center; | ||
| } | ||
|
|
||
| .create-task input[type=text]{ | ||
| margin: 2.5em 2em; | ||
| width: 80%; | ||
| outline: none; | ||
| border: none; | ||
| padding: 0.7em; | ||
| } */ | ||
|
|
||
| .Card-btn { | ||
| display: flex; | ||
| justify-content: space-around; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import React, { useState, useEffect } from 'react' | ||
| import { Container } from 'reactstrap' | ||
|
|
||
| import InputData from './components/InputData' | ||
| import TaskList from './components/TaskList' | ||
| import './App.css' | ||
|
|
||
| const App = () => { | ||
| const [tasks, setTasks] = useState([]) | ||
| const [tasksRemaining, setTasksRemaining] = useState(0) | ||
|
|
||
| console.log(tasks) | ||
|
|
||
| useEffect(() => { | ||
| setTasksRemaining(tasks.filter((task) => !task.completed).length) | ||
| }, [tasks]) | ||
|
|
||
| const addTask = (title, role) => { | ||
| const newTasks = [...tasks, { title, role, completed: false }] | ||
| setTasks(newTasks) | ||
| } | ||
|
|
||
| const completeTask = (index) => { | ||
| const newTasks = [...tasks] | ||
| newTasks[index].completed = true | ||
| setTasks(newTasks) | ||
| } | ||
|
|
||
| const removeTask = (index) => { | ||
| const newTasks = [...tasks] | ||
| newTasks.splice(index, 1) | ||
| setTasks(newTasks) | ||
| } | ||
|
|
||
| const editTask = (index) => { | ||
| console.log('===> set todo => ', index) | ||
| setTasks(index) | ||
| } | ||
|
|
||
| return ( | ||
| <Container> | ||
| <InputData addTask={addTask} /> | ||
|
|
||
| <TaskList | ||
| tasks={tasks} | ||
| removeTask={removeTask} | ||
| editTask={editTask} | ||
| completeTask={completeTask} | ||
| tasksRemaining={tasksRemaining} | ||
| /> | ||
| </Container> | ||
| ) | ||
| } | ||
|
|
||
| export default App | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { render, screen } from '@testing-library/react'; | ||
| import App from './App'; | ||
|
|
||
| test('renders learn react link', () => { | ||
| render(<App />); | ||
| const linkElement = screen.getByText(/learn react/i); | ||
| expect(linkElement).toBeInTheDocument(); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import React, { useState } from 'react' | ||
| import { Button, Form, FormGroup, Label, Input, Container, Row, Col } from 'reactstrap' | ||
|
|
||
| const InputData = ({ addTask }) => { | ||
| const [task, setTask] = useState('') | ||
| const [role, setRole] = useState('Office Boy') | ||
|
|
||
| const handleForm = (e) => { | ||
| if (!task) { | ||
| alert('Mohon lengkapi data') | ||
| } else { | ||
| e.preventDefault() | ||
| addTask(task, role) | ||
| setTask('') | ||
| } | ||
| } | ||
|
|
||
| return ( | ||
| <Container> | ||
| <Row className="Input-data mt-3 mb-5"> | ||
| <Col sm="6"> | ||
| <Form onSubmit={handleForm}> | ||
| <FormGroup> | ||
| <Label for="exampleInput">Task</Label> | ||
| <Input | ||
| type="text" | ||
| name="addTask" | ||
| id="inputData" | ||
| placeholder="input your task" | ||
| onChange={(e) => setTask(e.target.value)} | ||
| value={task} | ||
| /> | ||
| </FormGroup> | ||
|
|
||
| <FormGroup> | ||
| <Label for="exampleSelect">Role</Label> | ||
| <Input type="select" name="select" id="exampleSelect" onChange={(e) => setRole(e.target.value)} value={role}> | ||
| <option value="Office Boy">Office Boy</option> | ||
| <option value="Security">Security</option> | ||
| <option value="Driver">Driver</option> | ||
| </Input> | ||
| </FormGroup> | ||
|
|
||
| <Button>Submit</Button> | ||
| </Form> | ||
| </Col> | ||
| </Row> | ||
| </Container> | ||
| ) | ||
| } | ||
|
|
||
| export default InputData |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import React from 'react' | ||
| import { Card, CardText, Container } from 'reactstrap' | ||
|
anggapw marked this conversation as resolved.
|
||
|
|
||
| const TaskCard = ({ task, index, completeTask, editTask, removeTask }) => { | ||
| return ( | ||
| <Container className="mb-3"> | ||
| <Card body inverse color={task.completed ? 'success' : 'danger'}> | ||
| <CardText>{task.title}</CardText> | ||
| <p></p> | ||
| <div className="Card-btn"> | ||
| <i className="fas fa-check-circle fa-2x fa-fw" onClick={() => completeTask(index)}></i> | ||
| <i className="fas fa-pen fa-2x fa-fw" onClick={() => editTask(index)}></i> | ||
| <i className="fas fa-trash-alt fa-2x fa-fw" onClick={() => removeTask(index)}></i> | ||
| </div> | ||
| </Card> | ||
| </Container> | ||
| ) | ||
| } | ||
|
|
||
| export default TaskCard | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sebaiknya effect diberi command sehingga kita bisa tahu ini effect untuk apa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
karena kita nggak bisa kasih nama effect seperti kasih nama variable dan function dengan meaningfull name, makanya di usahakan kasih comment agar yg baca dan kita sendiri sewaktu lihat kode bisa dengan cepat mengerti kegunaan effect ini