Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ test-results/

# generated files
shared/types/lexicons
file-tree-sprite.svg

**/__screenshots__/**

Expand Down
27 changes: 20 additions & 7 deletions app/components/Code/DirectoryListing.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { PackageFileTree } from '#shared/types'
import type { RouteLocationRaw } from 'vue-router'
import { getFileIcon } from '~/utils/file-icons'
import { ADDITIONAL_ICONS, getFileIcon } from '~/utils/file-icons'

const props = defineProps<{
tree: PackageFileTree[]
Expand Down Expand Up @@ -80,8 +80,15 @@ const bytesFormatter = useBytesFormatter()
:to="getCodeRoute(parentPath || undefined)"
class="py-2 px-4 font-mono text-sm w-full"
no-underline
classicon="i-carbon:folder text-yellow-600"
>
<svg
class="size-[1em] me-1 shrink-0 text-yellow-600"
viewBox="0 0 16 16"
fill="currentColor"
aria-hidden="true"
>
<use :href="`/file-tree-sprite.svg#${ADDITIONAL_ICONS['folder']}`" />
</svg>
<span class="w-full flex justify-self-stretch items-center gap-2"> .. </span>
</LinkBase>
</td>
Expand All @@ -98,12 +105,18 @@ const bytesFormatter = useBytesFormatter()
:to="getCodeRoute(node.path)"
class="py-2 px-4 font-mono text-sm w-full"
no-underline
:classicon="
node.type === 'directory'
? 'i-carbon:folder text-yellow-600'
: getFileIcon(node.name)
"
>
<svg
class="size-[1em] me-1 shrink-0"
viewBox="0 0 16 16"
fill="currentColor"
:class="node.type === 'directory' ? 'text-yellow-600' : undefined"
aria-hidden="true"
>
<use
:href="`/file-tree-sprite.svg#${node.type === 'directory' ? ADDITIONAL_ICONS['folder'] : getFileIcon(node.name)}`"
/>
</svg>
<span class="w-full flex justify-self-stretch items-center gap-2">
<span class="flex-1">{{ node.name }}</span>
<span
Expand Down
30 changes: 20 additions & 10 deletions app/components/Code/FileTree.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { PackageFileTree } from '#shared/types'
import type { RouteLocationRaw } from 'vue-router'
import { getFileIcon } from '~/utils/file-icons'
import { ADDITIONAL_ICONS, getFileIcon } from '~/utils/file-icons'

const props = defineProps<{
tree: PackageFileTree[]
Expand Down Expand Up @@ -57,14 +57,17 @@ watch(
@click="toggleDir(node.path)"
:classicon="isExpanded(node.path) ? 'i-carbon:chevron-down' : 'i-carbon:chevron-right'"
>
<span
class="w-4 h-4 shrink-0"
:class="
isExpanded(node.path)
? 'i-carbon:folder-open text-yellow-500'
: 'i-carbon:folder text-yellow-600'
"
/>
<svg
class="size-[1em] me-1 shrink-0"
:class="isExpanded(node.path) ? 'text-yellow-500' : 'text-yellow-600'"
viewBox="0 0 16 16"
fill="currentColor"
aria-hidden="true"
>
<use
:href="`/file-tree-sprite.svg#${isExpanded(node.path) ? ADDITIONAL_ICONS['folder-open'] : ADDITIONAL_ICONS['folder']}`"
/>
</svg>
<span class="truncate">{{ node.name }}</span>
</ButtonBase>
<CodeFileTree
Expand All @@ -86,8 +89,15 @@ watch(
class="w-full justify-start! rounded-none! border-none!"
block
:style="{ paddingLeft: `${depth * 12 + 32}px` }"
:classicon="getFileIcon(node.name)"
>
<svg
class="size-[1em] me-1 shrink-0"
viewBox="0 0 16 16"
fill="currentColor"
aria-hidden="true"
>
<use :href="`/file-tree-sprite.svg#${getFileIcon(node.name)}`" />
</svg>
<span class="truncate">{{ node.name }}</span>
</LinkBase>
</template>
Expand Down
Loading
Loading