Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 45 additions & 29 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,35 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Open Source To-Do App</title>
<link rel="stylesheet" href="style.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Open Source To-Do App</title>
<link rel="stylesheet" href="style.css">
</head>

<body>
<div id="app">
<!-- Components will be injected here by other members -->
<header id="main-header"></header>

<main id="main-content">
<!-- Search Bar will go here (Issue #19) -->
<div id="search-container"></div>

<!-- Input Section (Issue #5 & #11) -->
<div id="input-section"></div>

<!-- Task List (Issue #10) -->
<ul id="task-list"></ul>

<!-- Empty State (Issue #17) -->
<div id="empty-state"></div>

<!-- Filter Controls (Issue #13) -->
<div id="filter-controls"></div>
</main>

<footer id="main-footer"></footer>
</div>
<script src="script.js"></script>

<div id="app">

<header id="main-header"></header>

<main id="main-content">

<div id="search-container"></div>

<!-- Input Section -->
<div id="input-section">

<input type="text" id="task-input" placeholder="Enter a task">

<select id="priority-select">
<option value="Low">Low Priority</option>
<option value="Medium">Medium Priority</option>
<option value="High">High Priority</option>
</select>

<button id="add-task-btn">Add Task</button>

</div>

<!-- Task List -->
<ul id="task-list"></ul>

<div id="empty-state"></div>

<div id="filter-controls"></div>

</main>

<footer id="main-footer"></footer>

</div>

<script src="script.js"></script>

</body>
</html>
</html>
56 changes: 51 additions & 5 deletions public/script.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,58 @@
// State Management
let tasks = [];

// DOM Elements (Will be populated as elements are added)
const taskList = document.getElementById('task-list');
// DOM Elements
const taskList = document.getElementById("task-list");
const taskInput = document.getElementById("task-input");
const prioritySelect = document.getElementById("priority-select");
const addTaskBtn = document.getElementById("add-task-btn");

// Initial Render
document.addEventListener('DOMContentLoaded', () => {
// Initialize App
document.addEventListener("DOMContentLoaded", () => {
console.log("App Initialized");
// Load tasks will be called here later (Issue #9)

addTaskBtn.addEventListener("click", addTask);
});

// Add Task Function
function addTask() {

const text = taskInput.value.trim();
const priority = prioritySelect.value;

if (text === "") return;

const task = {
text: text,
completed: false,
priority: priority
};

tasks.push(task);

taskInput.value = "";

renderTasks();
}

// Render Tasks
function renderTasks() {

taskList.innerHTML = "";

tasks.forEach((task) => {

const li = document.createElement("li");

li.innerHTML = `
${task.text}
<span class="priority ${task.priority}">
${task.priority}
</span>
`;

taskList.appendChild(li);

});

}
59 changes: 47 additions & 12 deletions public/style.css
Original file line number Diff line number Diff line change
@@ -1,22 +1,57 @@
/* Basic Reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f4f4f4;
color: #333;
line-height: 1.6;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f4f4f4;
color: #333;
line-height: 1.6;
}

#app {
max-width: 600px;
margin: 0 auto;
min-height: 100vh;
display: flex;
flex-direction: column;
max-width: 600px;
margin: 0 auto;
min-height: 100vh;
display: flex;
flex-direction: column;
}

/* Task list */
#task-list {
list-style: none;
margin-top: 20px;
}

#task-list li {
padding: 10px;
background: white;
margin-bottom: 10px;
border-radius: 5px;
display: flex;
justify-content: space-between;
}

/* Priority Styles */

.priority {
padding: 3px 8px;
border-radius: 4px;
font-size: 12px;
color: white;
}

.High {
background: red;
}

.Medium {
background: orange;
}

.Low {
background: green;
}