feat: improved swipe paging #64

This commit is contained in:
leukipp
2025-10-30 14:30:53 +01:00
parent 81b4c30aa2
commit c85055a222
2 changed files with 29 additions and 7 deletions
+28 -6
View File
@@ -3,8 +3,20 @@
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-inline'" />
<style>
[data-theme="dark"] {
--background-color: rgba(225, 225, 225, 0.15);
--previous-cursor: w-resize;
--next-cursor: e-resize;
}
[data-theme="light"] {
--background-color: rgba(33, 33, 33, 0.15);
--previous-cursor: w-resize;
--next-cursor: e-resize;
}
[data-theme="hidden"] {
--background-color: rgba(0, 0, 0, 0);
--previous-cursor: none;
--next-cursor: none;
}
::-webkit-scrollbar {
display: none;
@@ -27,24 +39,31 @@
width: 100vw;
height: 100vh;
list-style-type: none;
background: var(--background-color);
}
li {
display: flex;
align-items: center;
flex: 0 0 auto;
}
li:not(.disabled) #previous {
cursor: var(--previous-cursor);
}
li:not(.disabled) #next {
cursor: var(--next-cursor);
}
button {
width: 100vw;
height: 50vh;
border: none;
cursor: not-allowed;
background-color: transparent;
}
#previous {
cursor: w-resize;
button:not(:active) {
transition: background-color 500ms step-end;
}
#next {
cursor: e-resize;
menu:has(button:active) button {
background-color: var(--background-color);
transition-duration: 0ms;
}
</style>
</head>
@@ -62,13 +81,16 @@
const registerSendEvents = () => {
document.querySelectorAll("button").forEach((button) => {
button.addEventListener("click", (e) => {
button.addEventListener("pointerdown", (e) => {
ipcRenderer.send("button-click", { id: e.target.id });
});
});
};
const registerReceiveEvents = () => {
ipcRenderer.on("button-disabled", (e, button) => {
document.getElementById(button.id).parentNode.classList.toggle("disabled", button.disabled);
});
ipcRenderer.on("data-theme", (e, data) => {
document.documentElement.setAttribute("data-theme", data.theme);
});
+1 -1
View File
@@ -100,7 +100,7 @@
</head>
<body>
<header>
<h1 id="title"></h1>
<h1 id="title">TouchKio</h1>
</header>
<menu>
<li>