Skip to content

Commit

Permalink
feat: disable read rle button
Browse files Browse the repository at this point in the history
  • Loading branch information
rei1024 committed Oct 3, 2024
1 parent f0dcdd2 commit 0642f6f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,21 @@ configButton.addEventListener("click", () => {
}
});

const readRLE = document.getElementById("readRLE") as HTMLElement;
const readRLE = document.getElementById("readRLE") as HTMLButtonElement;
const rleErrorMessage = document.getElementById("rleError") as HTMLElement;
const inputRLE = document.getElementById("inputRLE") as HTMLTextAreaElement;
function updateReadRLEButton() {
if (inputRLE.value.trim() === "") {
readRLE.disabled = true;
} else {
readRLE.disabled = false;
}
}
updateReadRLEButton();
inputRLE.addEventListener("input", () => {
updateReadRLEButton();
});

readRLE.addEventListener("click", () => {
autoRandom.checked = false;
clearCell();
Expand Down
9 changes: 9 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ dialog button.btn:focus {
box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.5); /* フォーカス時のシャドウ */
}

/* disabled時のスタイル */
dialog button.btn:disabled {
cursor: not-allowed; /* 無効時のカーソル */
background-color: lightgray; /* 無効時の背景色 */
color: darkgray; /* 無効時の文字色 */
border: 2px solid gray; /* 無効時のボーダー */
opacity: 0.6; /* 半透明にする */
}

#rleError {
color: #dc2626; /* red-600 */
}

0 comments on commit 0642f6f

Please sign in to comment.