Files
nocodb/packages/nc-gui/composables/useAttachmentIcon.ts
DarkPhoenix2704 ece54c3630 fix: attachnment
2025-02-17 13:11:45 +00:00

41 lines
1011 B
TypeScript

export const useAttachmentIcon = (
title: MaybeRefOrGetter<string | undefined>,
mimetype: MaybeRefOrGetter<string | undefined>,
) => {
return computed<keyof typeof iconMap>(() => {
if (isImage(toValue(title) || '', toValue(mimetype))) {
return 'ncFileTypeImage'
}
if (isPdf(toValue(title) || '', toValue(mimetype))) {
return 'ncFileTypePdf'
}
if (isVideo(toValue(title) || '', toValue(mimetype))) {
return 'ncFileTypeVideo'
}
if (isAudio(toValue(title) || '', toValue(mimetype))) {
return 'ncFileTypeAudio'
}
if (isWord(toValue(title) || '', toValue(mimetype))) {
return 'ncFileTypeWord'
}
if (isExcel(toValue(title) || '', toValue(mimetype))) {
return 'ncFileTypeCsv'
}
if (isPresentation(toValue(title) || '', toValue(mimetype))) {
return 'ncFileTypePresentation'
}
if (isZip(toValue(title) || '', toValue(mimetype))) {
return 'ncFileTypeZip'
}
return 'ncFileTypeUnknown'
})
}