var archived = [];
var theme = {
colorScheme: "default",
- css: ""
+ css: "",
+ showCompleted: false
};
if (localStorage.getItem("todos")) {
document.getElementById("createTodo").addEventListener("click", () => {
+ document.documentElement.scrollTop = 0;
+
todos.uncompleted = [
{
description: ""
hydrateUncompleted();
applyListeners();
+ document.getElementById("todo-uncompleted-0-description").focus();
backupData();
});
+const todosCompleted = document.getElementById("todos-completed");
+
+const doShowCompleted = (backup = false) => {
+
+ if (theme.showCompleted) {
+
+ todosCompleted.classList.remove("hidden");
+ } else {
+
+ todosCompleted.classList.add("hidden");
+ }
+
+ if (backup) backupData();
+}
+
+doShowCompleted()
+
document.getElementById("showCompleted").addEventListener("click", () => {
- document.getElementById("todos-completed").classList.toggle("hidden");
+ theme.showCompleted = !theme.showCompleted;
+ doShowCompleted(true);
resizeTextHeights();
});
:root {
color-scheme: light dark;
+
+ --border-radius-inner: 0.25rem;
+ --border-radius-outer: calc(var(--border-radius-inner) * 2);
}
body {
}
}
+body:has(#todos) header > hr {
+ margin-bottom: 0;
+}
+
nav {
display: flex;
flex-wrap: wrap;
#main {
display: flex;
+ flex-direction: column;
width: 100%;
- justify-content: center;
+ align-items: center;
& > div, #todos, #todos-completed, #archived {
max-width: 400px;
width: 100%;
}
}
+#todos:not(:has(*)) {
+ display: none !important;
+}
+
+#archived todo:first-child {
+ border-top-left-radius: var(--border-radius-outer) !important;
+ border-top-right-radius: var(--border-radius-outer) !important;
+}
+
+#todos-completed todo:last-child,
+#archived todo:last-child {
+ border-bottom-left-radius: var(--border-radius-outer) !important;
+ border-bottom-right-radius: var(--border-radius-outer) !important;
+}
+
todo {
background-color: var(--background-secondary);
- border-radius: 0.5rem;
+ border-radius: var(--border-radius-inner);
display: flex;
padding: 0.5rem;
gap: 0.5rem;
cursor: pointer;
&:hover {
text-decoration: underline;
+ background-color: var(--background-tertiary);
}
}
}
color: var(--text-primary);
background-color: var(--background-secondary);
border: unset;
- border-radius: 0.5rem;
+ border-radius: var(--border-radius-outer);
width: 100%;
display: flex;
align-items: center;
cursor: pointer;
}
+todo, button {
+ transition: 0.05s ease-in;
+}
+
+div:has(> #createTodo) {
+ position: sticky;
+ top: 0;
+
+ padding: 0.5rem 0 0.25rem;
+ background-color: var(--background-primary);
+}
+
+#createTodo {
+ border-bottom-left-radius: var(--border-radius-inner);
+ border-bottom-right-radius: var(--border-radius-inner);
+}
+
+#showCompleted {
+ border-top-left-radius: var(--border-radius-inner);
+ border-top-right-radius: var(--border-radius-inner);
+}
+
.themes {
display: flex;
flex-wrap: wrap;
display: none;
}
+#main div:not(:has(#todos-completed.hidden)) #showCompleted {
+ border-bottom-left-radius: var(--border-radius-inner);
+ border-bottom-right-radius: var(--border-radius-inner);
+}
+
@media screen and (max-width: 400px) {
h3 {
font-size: 1.5rem !important;