Загрузить файлы в «z2/frontend»
This commit is contained in:
parent
26b03c553b
commit
79dd761741
30
z2/frontend/index.html
Normal file
30
z2/frontend/index.html
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>To-Do List</title>
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="app-container">
|
||||||
|
<h1>What should i do list (Reminder)</h1>
|
||||||
|
<p class="subtitle">What needs to be done today</p>
|
||||||
|
|
||||||
|
<form id="task-form">
|
||||||
|
<input type="text" id="task-input" placeholder="Enter a new task">
|
||||||
|
<button type="submit">Add</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="filter-buttons">
|
||||||
|
<button class="filter active" data-filter="all">All</button>
|
||||||
|
<button class="filter" data-filter="active">Active</button>
|
||||||
|
<button class="filter" data-filter="completed">Completed</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul id="task-list"></ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="script.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
36
z2/frontend/script.js
Normal file
36
z2/frontend/script.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
const taskForm = document.getElementById("task-form");
|
||||||
|
const taskInput = document.getElementById("task-input");
|
||||||
|
const taskList = document.getElementById("task-list");
|
||||||
|
|
||||||
|
function loadTasks() {
|
||||||
|
fetch("/api/tasks")
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(tasks => {
|
||||||
|
taskList.innerHTML = "";
|
||||||
|
tasks.forEach(t => {
|
||||||
|
const li = document.createElement("li");
|
||||||
|
li.textContent = t.task;
|
||||||
|
taskList.appendChild(li);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
taskForm.addEventListener("submit", e => {
|
||||||
|
e.preventDefault();
|
||||||
|
const task = taskInput.value.trim();
|
||||||
|
if (!task) return;
|
||||||
|
|
||||||
|
fetch("/api/tasks", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({ task })
|
||||||
|
}).then(() => {
|
||||||
|
taskInput.value = "";
|
||||||
|
loadTasks();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
loadTasks();
|
||||||
|
});
|
||||||
|
|
150
z2/frontend/style.css
Normal file
150
z2/frontend/style.css
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
body {
|
||||||
|
font-family: "Helvetica Neue", sans-serif;
|
||||||
|
background: linear-gradient(to bottom, #f7f7f7, #e1e1e1);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-container {
|
||||||
|
background-color: #ffffff;
|
||||||
|
padding: 40px;
|
||||||
|
border-radius: 20px;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 500px;
|
||||||
|
box-shadow: 0px 15px 20px rgba(0, 0, 0, 0.3);
|
||||||
|
border: 1px solid #d9d9d9;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-family: "Helvetica", sans-serif;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
font-size: 30px;
|
||||||
|
color: #4a4a4a;
|
||||||
|
text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtitle {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #6d6d72;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
font-weight: 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#task-input {
|
||||||
|
flex-grow: 1;
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid #c7c7c7;
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
font-size: 18px;
|
||||||
|
box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
form button {
|
||||||
|
padding: 15px 25px;
|
||||||
|
border: none;
|
||||||
|
background: linear-gradient(to bottom, #4da6ff, #0066cc);
|
||||||
|
color: #ffffff;
|
||||||
|
border-radius: 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
text-shadow: 0px -1px 1px rgba(0, 0, 0, 0.3);
|
||||||
|
box-shadow: 0px 5px 8px rgba(0, 0, 0, 0.2);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
form button:active {
|
||||||
|
background: linear-gradient(to bottom, #0066cc, #4da6ff);
|
||||||
|
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2);
|
||||||
|
transform: translateY(2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-buttons {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter {
|
||||||
|
background: linear-gradient(to bottom, #e6e6e6, #d1d1d1);
|
||||||
|
border: 1px solid #c3c3c3;
|
||||||
|
padding: 10px 20px;
|
||||||
|
color: #4a4a4a;
|
||||||
|
border-radius: 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.6);
|
||||||
|
box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.15);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter.active, .filter:hover {
|
||||||
|
background: linear-gradient(to bottom, #4da6ff, #0066cc);
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
#task-list {
|
||||||
|
list-style: none;
|
||||||
|
max-height: 400px;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 10px 0;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid #e2e2e2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-item {
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
||||||
|
transition: background 0.3s ease;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-item:hover {
|
||||||
|
background: linear-gradient(to bottom, #4da6ff, #0066cc);
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-item.completed {
|
||||||
|
text-decoration: line-through;
|
||||||
|
color: #a09b8d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-actions button {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-actions button.complete-btn {
|
||||||
|
color: #60a36e;
|
||||||
|
text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-actions button.delete-btn {
|
||||||
|
color: #d9534f;
|
||||||
|
text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user