mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1003 B
40 lines
1003 B
export const useAttachmentIcon = ( |
|
title: MaybeRefOrGetter<string | undefined>, |
|
mimetype: MaybeRefOrGetter<string | undefined>, |
|
) => { |
|
return computed<keyof typeof iconMap>(() => { |
|
if (isImage(toValue(title) || '', toValue(mimetype))) { |
|
return 'image' |
|
} |
|
|
|
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 'ncFileTypeExcel' |
|
} |
|
|
|
if (isPresentation(toValue(title) || '', toValue(mimetype))) { |
|
return 'ncFileTypePresentation' |
|
} |
|
|
|
if (isZip(toValue(title) || '', toValue(mimetype))) { |
|
return 'ncFileTypeZip' |
|
} |
|
|
|
return 'ncFileTypeUnknown' |
|
}) |
|
}
|
|
|