|
@@ -1,4 +1,4 @@
|
|
|
-const { iconFile, iconText, iconAudio, iconVideo, iconPDF } = require('../components/icons')
|
|
|
+const { iconFile, iconText, iconImage, iconAudio, iconVideo, iconPDF, iconArchive } = require('../components/icons')
|
|
|
|
|
|
module.exports = function getIconByMime (fileType) {
|
|
|
const defaultChoice = {
|
|
@@ -11,6 +11,7 @@ module.exports = function getIconByMime (fileType) {
|
|
|
const fileTypeGeneral = fileType.split('/')[0]
|
|
|
const fileTypeSpecific = fileType.split('/')[1]
|
|
|
|
|
|
+ // Text
|
|
|
if (fileTypeGeneral === 'text') {
|
|
|
return {
|
|
|
color: '#5a5e69',
|
|
@@ -18,6 +19,15 @@ module.exports = function getIconByMime (fileType) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // Image
|
|
|
+ if (fileTypeGeneral === 'image') {
|
|
|
+ return {
|
|
|
+ color: '#686de0',
|
|
|
+ icon: iconImage()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Audio
|
|
|
if (fileTypeGeneral === 'audio') {
|
|
|
return {
|
|
|
color: '#068dbb',
|
|
@@ -25,6 +35,7 @@ module.exports = function getIconByMime (fileType) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // Video
|
|
|
if (fileTypeGeneral === 'video') {
|
|
|
return {
|
|
|
color: '#19af67',
|
|
@@ -32,6 +43,7 @@ module.exports = function getIconByMime (fileType) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // PDF
|
|
|
if (fileTypeGeneral === 'application' && fileTypeSpecific === 'pdf') {
|
|
|
return {
|
|
|
color: '#e25149',
|
|
@@ -39,10 +51,12 @@ module.exports = function getIconByMime (fileType) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (fileTypeGeneral === 'image') {
|
|
|
+ // Archive
|
|
|
+ const archiveTypes = ['zip', 'x-7z-compressed', 'x-rar-compressed', 'x-gtar', 'x-apple-diskimage', 'x-diskcopy']
|
|
|
+ if (fileTypeGeneral === 'application' && archiveTypes.indexOf(fileTypeSpecific) !== -1) {
|
|
|
return {
|
|
|
- color: '#f2f2f2',
|
|
|
- icon: ''
|
|
|
+ color: '#00C469',
|
|
|
+ icon: iconArchive()
|
|
|
}
|
|
|
}
|
|
|
|