feat: add Nimbus UI mode with adaptive scrollbars and layout improvements
This commit is contained in:
@@ -13,7 +13,7 @@ import { VaultService } from '../../services/vault.service';
|
||||
@let folder = node;
|
||||
<div>
|
||||
<div
|
||||
(click)="toggleFolder(folder)"
|
||||
(click)="onFolderClick(folder)"
|
||||
class="flex items-center cursor-pointer p-2 rounded my-0.5 text-sm hover:bg-obs-l-bg-main dark:hover:bg-obs-d-bg-main"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-2 transition-transform text-obs-l-text-muted dark:text-obs-d-text-muted" [class.rotate-90]="folder.isOpen" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
@@ -27,26 +27,30 @@ import { VaultService } from '../../services/vault.service';
|
||||
<app-file-explorer
|
||||
[nodes]="folder.children"
|
||||
[selectedNoteId]="selectedNoteId()"
|
||||
[foldersOnly]="foldersOnly()"
|
||||
(folderSelected)="folderSelected.emit($event)"
|
||||
(fileSelected)="onFileSelected($event)"
|
||||
></app-file-explorer>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
@let file = node;
|
||||
<div
|
||||
(click)="onFileSelected(file.id)"
|
||||
class="flex items-center cursor-pointer p-2 rounded my-0.5 text-sm ml-5"
|
||||
[class.bg-obs-l-bg-main]="selectedNoteId() === file.id"
|
||||
[class.dark:bg-obs-d-bg-main]="selectedNoteId() === file.id"
|
||||
[class.hover:bg-obs-l-bg-main]="selectedNoteId() !== file.id"
|
||||
[class.dark:hover:bg-obs-d-bg-main]="selectedNoteId() !== file.id"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-2 flex-shrink-0 text-obs-l-text-muted dark:text-obs-d-text-muted" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
||||
</svg>
|
||||
<span class="truncate">{{ file.name }}</span>
|
||||
</div>
|
||||
@if (!foldersOnly()) {
|
||||
@let file = node;
|
||||
<div
|
||||
(click)="onFileSelected(file.id)"
|
||||
class="flex items-center cursor-pointer p-2 rounded my-0.5 text-sm ml-5"
|
||||
[class.bg-obs-l-bg-main]="selectedNoteId() === file.id"
|
||||
[class.dark:bg-obs-d-bg-main]="selectedNoteId() === file.id"
|
||||
[class.hover:bg-obs-l-bg-main]="selectedNoteId() !== file.id"
|
||||
[class.dark:hover:bg-obs-d-bg-main]="selectedNoteId() !== file.id"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-2 flex-shrink-0 text-obs-l-text-muted dark:text-obs-d-text-muted" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
||||
</svg>
|
||||
<span class="truncate">{{ file.name }}</span>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</li>
|
||||
}
|
||||
@@ -58,7 +62,9 @@ import { VaultService } from '../../services/vault.service';
|
||||
export class FileExplorerComponent {
|
||||
nodes = input.required<VaultNode[]>();
|
||||
selectedNoteId = input<string | null>(null);
|
||||
foldersOnly = input<boolean>(false);
|
||||
fileSelected = output<string>();
|
||||
folderSelected = output<string>();
|
||||
|
||||
private vaultService = inject(VaultService);
|
||||
|
||||
@@ -68,6 +74,13 @@ export class FileExplorerComponent {
|
||||
}
|
||||
}
|
||||
|
||||
onFolderClick(folder: VaultFolder) {
|
||||
this.toggleFolder(folder);
|
||||
if (folder?.path) {
|
||||
this.folderSelected.emit(folder.path);
|
||||
}
|
||||
}
|
||||
|
||||
toggleFolder(folder: VaultFolder) {
|
||||
this.vaultService.toggleFolder(folder.path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user