43 lines
964 B
Vue
43 lines
964 B
Vue
<template>
|
|
<AppIcon v-if="directory" name="folder" class="file-icon" />
|
|
<svg
|
|
v-else
|
|
class="app-icon file-icon"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="1.4"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
aria-hidden="true"
|
|
>
|
|
<path d="M5 2h9l5 5v15H5z M14 2v6h5" />
|
|
<text
|
|
v-if="extension"
|
|
x="12"
|
|
y="17"
|
|
text-anchor="middle"
|
|
fill="currentColor"
|
|
stroke="none"
|
|
font-size="3.8"
|
|
font-weight="650"
|
|
font-family="system-ui, sans-serif"
|
|
>
|
|
{{ extension }}
|
|
</text>
|
|
<path v-else d="M8 12h8 M8 16h6" />
|
|
</svg>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import { computed } from "vue";
|
|
import AppIcon from "../AppIcon.vue";
|
|
const props = defineProps<{ name: string; directory?: boolean }>();
|
|
const extension = computed(
|
|
() =>
|
|
props.name
|
|
.match(/\.([^.]+)$/)?.[0]
|
|
.slice(0, 5)
|
|
.toLowerCase() || ""
|
|
);
|
|
</script>
|