From 79dd761741039a50434c38e264993c4377a79898 Mon Sep 17 00:00:00 2001 From: Yan Kasabutski Date: Thu, 17 Apr 2025 01:55:42 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?z2/frontend=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- z2/frontend/index.html | 30 +++++++++ z2/frontend/script.js | 36 ++++++++++ z2/frontend/style.css | 150 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 216 insertions(+) create mode 100644 z2/frontend/index.html create mode 100644 z2/frontend/script.js create mode 100644 z2/frontend/style.css diff --git a/z2/frontend/index.html b/z2/frontend/index.html new file mode 100644 index 0000000..f98e0d6 --- /dev/null +++ b/z2/frontend/index.html @@ -0,0 +1,30 @@ + + + + + + To-Do List + + + +
+

What should i do list (Reminder)

+

What needs to be done today

+ +
+ + +
+ +
+ + + +
+ + +
+ + + + diff --git a/z2/frontend/script.js b/z2/frontend/script.js new file mode 100644 index 0000000..18955a5 --- /dev/null +++ b/z2/frontend/script.js @@ -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(); +}); + diff --git a/z2/frontend/style.css b/z2/frontend/style.css new file mode 100644 index 0000000..e2cf587 --- /dev/null +++ b/z2/frontend/style.css @@ -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); +}