Skip to content

Commit

Permalink
fix st3v3nmw#1000 sidebar indent (st3v3nmw#1001)
Browse files Browse the repository at this point in the history
  • Loading branch information
Newdea authored Jul 20, 2024
1 parent e3a0146 commit 83590be
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/gui/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export class ReviewQueueListView extends ItemView {
public redraw(): void {
const activeFile: TFile | null = this.app.workspace.getActiveFile();

const rootEl: HTMLElement = createDiv("nav-folder mod-root");
const childrenEl: HTMLElement = rootEl.createDiv("nav-folder-children");
const rootEl: HTMLElement = createDiv();
const childrenEl: HTMLElement = rootEl;

for (const deckKey in this.plugin.reviewDecks) {
const deck: ReviewDeck = this.plugin.reviewDecks[deckKey];
Expand All @@ -57,7 +57,7 @@ export class ReviewQueueListView extends ItemView {
deckCollapsed,
false,
deck,
).getElementsByClassName("nav-folder-children")[0] as HTMLElement;
).getElementsByClassName("tree-item-children")[0] as HTMLElement;

if (deck.newNotes.length > 0) {
const newNotesFolderEl: HTMLElement = this.createRightPaneFolder(
Expand Down Expand Up @@ -154,19 +154,19 @@ export class ReviewQueueListView extends ItemView {
hidden: boolean,
deck: ReviewDeck,
): HTMLElement {
const folderEl: HTMLDivElement = parentEl.createDiv("nav-folder");
const folderTitleEl: HTMLDivElement = folderEl.createDiv("nav-folder-title");
const childrenEl: HTMLDivElement = folderEl.createDiv("nav-folder-children");
const folderEl: HTMLDivElement = parentEl.createDiv("tree-item");
const folderTitleEl: HTMLDivElement = folderEl.createDiv("tree-item-self");
const childrenEl: HTMLDivElement = folderEl.createDiv("tree-item-children");
const collapseIconEl: HTMLDivElement = folderTitleEl.createDiv(
"nav-folder-collapse-indicator collapse-icon",
"tree-item-collapse-indicator collapse-icon",
);

collapseIconEl.innerHTML = COLLAPSE_ICON;
if (collapsed) {
(collapseIconEl.childNodes[0] as HTMLElement).style.transform = "rotate(-90deg)";
}

folderTitleEl.createDiv("nav-folder-title-content").setText(folderTitle);
folderTitleEl.createDiv("tree-item-content").setText(folderTitle);

if (hidden) {
folderEl.style.display = "none";
Expand Down Expand Up @@ -199,18 +199,18 @@ export class ReviewQueueListView extends ItemView {
plugin: SRPlugin,
): void {
const navFileEl: HTMLElement = folderEl
.getElementsByClassName("nav-folder-children")[0]
.createDiv("nav-file");
.getElementsByClassName("tree-item-children")[0]
.createDiv("tree-item");
if (hidden) {
navFileEl.style.display = "none";
}

const navFileTitle: HTMLElement = navFileEl.createDiv("nav-file-title");
const navFileTitle: HTMLElement = navFileEl.createDiv("tree-item-self");
if (fileElActive) {
navFileTitle.addClass("is-active");
}

navFileTitle.createDiv("nav-file-title-content").setText(file.basename);
navFileTitle.createDiv("tree-item-content").setText(file.basename);
navFileTitle.addEventListener(
"click",
async (event: MouseEvent) => {
Expand Down Expand Up @@ -239,7 +239,7 @@ export class ReviewQueueListView extends ItemView {
}

private changeFolderIconToExpanded(folderEl: HTMLElement): void {
const collapseIconEl = folderEl.find("div.nav-folder-collapse-indicator");
const collapseIconEl = folderEl.find("div.tree-item-collapse-indicator");
(collapseIconEl.childNodes[0] as HTMLElement).style.transform = "";
}
}

0 comments on commit 83590be

Please sign in to comment.