Skip to content

Commit faa8d1c

Browse files
Refactor deleteCompleted with filter and fix package.json metadata
1 parent 672cf47 commit faa8d1c

File tree

4 files changed

+51
-10
lines changed

4 files changed

+51
-10
lines changed

Sprint-3/quote-generator/style.css

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,30 @@
11
/** Write your CSS in here **/
2+
body {
3+
background-color: #f4f4f9;
4+
display: flex;
5+
justify-content: center;
6+
align-items: center;
7+
height: 100vh;
8+
font-family: sans-serif;
9+
}
10+
11+
#content {
12+
background: white;
13+
padding: 2rem;
14+
border-radius: 10px;
15+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
16+
text-align: center;
17+
}
18+
19+
button {
20+
background-color: #4a90e2;
21+
color: white;
22+
border: none;
23+
padding: 10px 20px;
24+
border-radius: 5px;
25+
cursor: pointer;
26+
}
27+
28+
button:hover {
29+
background-color: #357abd;
30+
}

Sprint-3/reading-list/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<link rel="stylesheet" href="style.css" />
7-
<title>Title here</title>
7+
<title>Reading List</title>
88
</head>
99
<body>
1010
<div id="content">

Sprint-3/todo-list/package.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,20 @@
44
"type": "module",
55
"license": "CC-BY-SA-4.0",
66
"description": "You must update this package",
7+
"repository": {
8+
"type": "git",
9+
"url": "git+https://github.com/CodeYourFuture/CYF-Coursework-Template.git"
10+
},
11+
"bugs": {
12+
"url": "https://github.com/CodeYourFuture/CYF-Coursework-Template/issues"
13+
},
14+
"homepage": "https://github.com/CodeYourFuture/CYF-Coursework-Template#readme",
715
"scripts": {
8-
"serve": "http-server"
16+
"serve": "http-server",
17+
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
18+
},
19+
"devDependencies": {
20+
"http-server": "^14.1.1",
21+
"jest": "^30.0.4"
922
}
1023
}

Sprint-3/todo-list/todos.mjs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ export function toggleCompletedOnTask(todos, taskIndex) {
2727
}
2828
}
2929

30-
// Remove all tasks that are marked as completed
30+
// Remove all tasks that are marked as completed using .filter()
3131
export function deleteCompleted(todos) {
32-
for (let i = todos.length - 1; i >= 0; i--) {
33-
if (todos[i].completed) {
34-
todos.splice(i, 1);
35-
}
36-
}
37-
}
38-
32+
const incompleteTasks = todos.filter(todo => todo.completed === false);
33+
34+
// Clear the original array and fill it with only incomplete tasks
35+
todos.length = 0;
36+
todos.push(...incompleteTasks);
37+
}

0 commit comments

Comments
 (0)