-
Notifications
You must be signed in to change notification settings - Fork 70
Project 1 - PTBC9 #42
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
base: main
Are you sure you want to change the base?
Changes from all commits
b041e85
6f7a3c1
37af366
4ec8265
cce3d34
3558735
3af73be
80bd126
688b24b
2ca445d
c2bd1a1
ff27146
c8cf488
adab8dc
bd2be03
ea172f6
331a2e5
5b2bc78
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| // Updating the first task in the this.state.tasks array | ||
|
|
||
| /** TaskUpdate Component Modifications | ||
| * In TaskUpdate.js, our constructor is modified as follows */ | ||
| class TaskUpdate { | ||
| constructor(props) { | ||
| super(props); | ||
|
|
||
| this.state = { | ||
| title: this.props.title, | ||
| task: this.props.task, | ||
| }; | ||
| // we initialize local state of 'TaskUpdate' with the 'title' and 'task' from the props | ||
| // this ensures that the input fields in the update form display the current values of the task being updated | ||
| } | ||
| } | ||
|
|
||
| // handleSubmit function | ||
| handleSubmit = (e) => { | ||
| e.preventDefault(); | ||
|
|
||
| const updatedTask = { | ||
| title: this.state.title, | ||
| task: this.state.task, | ||
| }; | ||
|
|
||
| this.props.updateTask(this.props.id, updatedTask); | ||
|
|
||
| this.props.updateTask(this.props.id, updatedTask); | ||
|
|
||
| // Close the update form by calling the callback function | ||
| this.props.onUpdateComplete(); | ||
| }; | ||
| /** Everytime the update button is clicked and the update form is submitted, we create an 'updatedTask' object with the new 'title' and 'task' values from the local state | ||
| * | ||
| */ | ||
|
|
||
| // Delete Logic | ||
|
|
||
| /** Defining handleDeleteClick Method in Task.js | ||
| * handleDeleteClick = () =>{ | ||
| * this.props.deleteTask(this.props.id) | ||
| * } | ||
| * Inside the handleDeleteClick function, you can call a deleteTask function that is passed as a prop from TaskList.js | ||
| */ | ||
|
|
||
| /** Passing the deleteTask function as a prop in the render method | ||
| * <Task | ||
| key={task.id} | ||
| {...task} | ||
| updateTask={this.updateTask} | ||
| deleteTask={this.deleteTask} | ||
| /> | ||
| */ | ||
|
|
||
| /** Handling deletion in deleteTask function | ||
| * deleteTask = (id) => { | ||
| this.setState((prevState)=>{ | ||
| const updatedTasks = prevState.tasks.filter((task)=>{ | ||
| task.id !== id | ||
| return { tasks: updatedTasks } | ||
| }) | ||
| }) | ||
| } | ||
|
|
||
| deleteTask takes in the id argument which is the id of the task to be deleted | ||
|
|
||
| this.setState() method is called to update the state in the TaskList Component and it takes the previous state (prevState) as an argument to update the current state based on its previous value | ||
|
|
||
| we declare an updatedTasks variable which is assigned the result of the filter method applied to the prevState.tasks array | ||
| filter() creates a new array by iterating over the original array's elements and including only those that meet a certain condition (excludes task with specific id -> task.id !== id) | ||
|
|
||
| Finally, this.setState returns an object with property tasks set to updatedTasks, which does not have the deleted task | ||
| */ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,17 @@ | |
| <head> | ||
| <meta charset="utf-8" /> | ||
| <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
| <link | ||
| href="https://fonts.googleapis.com/css2?family=Lobster&display=swap" | ||
| rel="stylesheet" | ||
| /> | ||
| <link | ||
| rel="stylesheet" | ||
| href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" | ||
| integrity="sha384-GLhlTQ8iWSevFYlK89irb/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jpZZ" | ||
| crossorigin="anonymous" | ||
| /> | ||
|
|
||
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| <meta name="theme-color" content="#000000" /> | ||
| <meta | ||
|
|
@@ -15,6 +26,11 @@ | |
| 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 | ||
| href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" | ||
| rel="stylesheet" | ||
| /> | ||
|
|
||
| <!-- | ||
| Notice the use of %PUBLIC_URL% in the tags above. | ||
| It will be replaced with the URL of the `public` folder during the build. | ||
|
|
@@ -28,8 +44,9 @@ | |
| </head> | ||
| <body> | ||
| <noscript>You need to enable JavaScript to run this app.</noscript> | ||
| <div id="root"></div> | ||
| <!-- | ||
| <div class="background-container"> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this a bootstrap class? If not, what purpose does it serve? I don't see any styling anywhere for it.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Used it but deleted the css |
||
| <div id="root"></div> | ||
| <!-- | ||
| This HTML file is a template. | ||
| If you open it directly in the browser, you will see an empty page. | ||
|
|
||
|
|
@@ -38,6 +55,6 @@ | |
|
|
||
| To begin the development, run `npm start` or `yarn start`. | ||
| To create a production bundle, use `npm run build` or `yarn build`. | ||
| --> | ||
| --></div> | ||
| </body> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,105 @@ | ||
| .App { | ||
| text-align: center; | ||
| /* App.css */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. redundant comment
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noted |
||
| .app-container { | ||
| display: flex; | ||
| flex-direction: column; | ||
| height: 100vh; /* height of 100vh ensures that the layout spans the full height */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. redundant comment
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noted |
||
| } | ||
|
|
||
| .App-logo { | ||
| height: 40vmin; | ||
| pointer-events: none; | ||
| .task-list, | ||
| .task-in-progress, | ||
| .task-in-review, | ||
| .task-completed { | ||
| flex: 1; /* Equal distribution of space */ | ||
| box-sizing: border-box; /* Include padding and border in the width calculation */ | ||
| width: calc(33.33% - 40px); /* 33.33% width with 20px margin on each side */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems responsive but might not actually be. 40px on a mobile screen might be a lot.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will test it out |
||
| margin: 20px 20px; | ||
| border: 1px solid #ccc; | ||
| padding: 16px; | ||
| border-radius: 12px; | ||
| opacity: 80%; | ||
| font-size: 27px; | ||
| } | ||
|
|
||
| .App-header { | ||
| background-color: #282c34; | ||
| min-height: 100vh; | ||
| .task-container { | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| flex: 1; /* This allows the task components to take up the available space */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you had a comment about this property already above |
||
| } | ||
|
|
||
| .header-2 { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think naming things with *-# is not exactly good. I would rather describe where the header is located or what kind of header it is instead of giving numbers |
||
| margin: 20px; | ||
| } | ||
|
|
||
| .task-list { | ||
| background: #e97e7e; | ||
| } | ||
|
|
||
| .task-in-progress { | ||
| background: cyan; | ||
| } | ||
|
|
||
| .task-in-review { | ||
| background: rgb(244, 244, 162); | ||
| } | ||
|
|
||
| .task-completed { | ||
| background: rgb(146, 246, 153); | ||
| } | ||
|
|
||
| .task-composer { | ||
| margin: 20px 0px 50px; | ||
| } | ||
|
|
||
| /* Style the Header as you need it. For example: */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. redundant comment |
||
| .header { | ||
| /* background: #333; */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's remove commented-out code before pushing |
||
| color: #fff; | ||
| font-size: 35px; | ||
| display: flex; /* flex container to enable */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. redundant comment |
||
| padding: 10px; | ||
| justify-content: center; | ||
| font-size: calc(10px + 2vmin); | ||
| align-items: center; | ||
| opacity: 30%; | ||
| } | ||
|
|
||
| .header-link { | ||
| color: white; | ||
| } | ||
|
|
||
| .content { | ||
| color: black; | ||
| } | ||
|
|
||
| .main { | ||
| opacity: 80%; | ||
| } | ||
|
|
||
| .buttons { | ||
| margin: 10px; | ||
| margin-bottom: 20px; | ||
| border-radius: 25%; | ||
| } | ||
|
|
||
| button { | ||
| margin-top: 15px; | ||
| border-radius: 25%; | ||
| } | ||
|
|
||
| .adjustments { | ||
| margin-bottom: 50px; | ||
| } | ||
|
|
||
| form input[type="text"], | ||
| form input[type="email"], | ||
| /* Add more selectors for other input types if needed */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. redundant comment |
||
| form input[type="submit"] { | ||
| border-radius: 8px; /* Adjust the value as needed */ | ||
| /* Other styling properties */ | ||
| /* For example: */ | ||
|
Comment on lines
+95
to
+97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. redundant comments |
||
| border: 1px solid #ccc; | ||
| padding: 8px; | ||
| margin-bottom: 10px; | ||
| } | ||
|
|
||
| form textarea[type="text"] { | ||
| border-radius: 8px; | ||
| } | ||
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.
Can explain the purpose of this document?
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.
No purpose