-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
122 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
import type { CollectionEntry } from 'astro:content' | ||
import fetchFileList from '../../utils/fetchFileList.ts' | ||
import type { File } from '../../utils/fetchFileList.ts' | ||
import FileListing from './FileListing.astro' | ||
import { Icon } from 'astro-icon/components' | ||
interface Props { | ||
noteId: CollectionEntry<'notes'>['id'] | ||
} | ||
const { noteId } = Astro.props | ||
let files: File[] = [] | ||
const fileListResponse = await fetchFileList(noteId) | ||
if (fileListResponse && fileListResponse.status === 200) { | ||
files = (await fileListResponse.json()) ?? [] | ||
// Remove index.md from the list | ||
files = files.filter((file) => file.name !== 'index.md') | ||
// Sort directories first | ||
files.sort((a, z) => (a.type === 'dir' && z.type !== 'dir' ? -1 : 1)) | ||
} | ||
--- | ||
|
||
<span class="flex items-center gap-2 py-1 ml-2 font-light"> | ||
<Icon name="material-symbols:file-copy-rounded" class="w-6 h-6" /> | ||
<p>EXPLORER</p> | ||
</span> | ||
{ | ||
files.length > 0 ? ( | ||
<FileListing {files} /> | ||
) : ( | ||
<p class="p-2 text-sm italic">No files for this note</p> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
import { Icon } from 'astro-icon/components' | ||
import type { File } from '../../utils/fetchFileList.ts' | ||
interface Props { | ||
files: File[] | ||
} | ||
const { files } = Astro.props | ||
--- | ||
|
||
<ul class="ml-4 py-2"> | ||
{ | ||
files.map((file) => ( | ||
<li class="px-2"> | ||
<a | ||
class="group/file inline-flex mb-2 transition-all line-clamp-1 hover:hover:no-underline" | ||
href={file.html_url} | ||
target="_blank" | ||
title={file.name} | ||
> | ||
<Icon | ||
class="w-5 h-5 mr-2 shrink-0" | ||
name={ | ||
file.type === 'dir' | ||
? 'material-symbols:folder' | ||
: 'material-symbols:lab-profile-outline' | ||
} | ||
/> | ||
<p class="basis-full underline group-hover/file:no-underline leading-5"> | ||
{file.name} | ||
</p> | ||
</a> | ||
</li> | ||
)) | ||
} | ||
</ul> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
import type { CollectionEntry } from 'astro:content' | ||
import FileExplorer from '../FileExplorer/FileExplorer.astro' | ||
import { Icon } from 'astro-icon/components' | ||
import Drawer from '../Drawer/Drawer.astro' | ||
import IconButton from '../Buttons/IconButton.astro' | ||
interface Props { | ||
note: CollectionEntry<'notes'> | ||
} | ||
const { note } = Astro.props | ||
--- | ||
|
||
<aside | ||
class:list={[ | ||
'pt-2 sticky top-20 bg-base mr-2 rounded-r-xl', | ||
'sm:mr-4', | ||
'md:basis-64 md:shrink-0 md:mr-4 md:p-2 md:rounded-xl', | ||
]} | ||
> | ||
<IconButton id="trigger-explorer-drawer" class="md:hidden"> | ||
<Icon | ||
name="material-symbols:drag-handle-rounded" | ||
class="w-8 h-8 rotate-90 text-secondary" | ||
/> | ||
</IconButton> | ||
<Drawer id="explorer-drawer"> | ||
<FileExplorer noteId={note.id} /> | ||
</Drawer> | ||
|
||
<section class="hidden md:block"> | ||
<FileExplorer noteId={note.id} /> | ||
</section> | ||
</aside> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters