feature: Add selected state style

This commit is contained in:
Rafael Cortês 2021-01-23 22:32:50 +00:00
parent 49bf898e0e
commit 242fc5ae7b
No known key found for this signature in database
GPG key ID: DB9A2ED429896D26
2 changed files with 12 additions and 2 deletions

View file

@ -5,6 +5,10 @@
* *
*/ */
.d2h-d-none {
display: none;
}
.d2h-wrapper { .d2h-wrapper {
text-align: left; text-align: left;
} }
@ -79,6 +83,10 @@
padding: 4px 8px; padding: 4px 8px;
} }
.d2h-file-collapse.d2h-selected {
background-color: #c8e1ff;
}
.d2h-file-collapse-input { .d2h-file-collapse-input {
margin: 0 4px 0 0; margin: 0 4px 0 0;
} }

View file

@ -118,8 +118,10 @@ export class Diff2HtmlUI {
.closest('.d2h-file-wrapper') .closest('.d2h-file-wrapper')
?.querySelector(selector); ?.querySelector(selector);
if (fileContents !== null && fileContents !== undefined) if (fileContents !== null && fileContents !== undefined) {
fileContents.style.display = fileContents.style.display === 'none' ? '' : 'none'; fileContentToggleBtn.classList.toggle('d2h-selected');
fileContents.classList.toggle('d2h-d-none');
}
}; };
const toggleHandler: (e: Event) => void = e => { const toggleHandler: (e: Event) => void = e => {