diff --git a/dist/img/icon/file/archive.svg b/dist/img/icon/file/archive.svg index 0b79ff9d7a..bcc255e8ea 100644 --- a/dist/img/icon/file/archive.svg +++ b/dist/img/icon/file/archive.svg @@ -1,11 +1,5 @@ - - - - - - - - - - + + + + \ No newline at end of file diff --git a/dist/img/icon/file/audio.svg b/dist/img/icon/file/audio.svg index 9db625828b..ea92b9990b 100644 --- a/dist/img/icon/file/audio.svg +++ b/dist/img/icon/file/audio.svg @@ -1,4 +1,7 @@ - - - + + + + + + \ No newline at end of file diff --git a/dist/img/icon/file/image.svg b/dist/img/icon/file/image.svg index 5a63e2e576..eff685e89a 100644 --- a/dist/img/icon/file/image.svg +++ b/dist/img/icon/file/image.svg @@ -1,5 +1,6 @@ - - - - + + + + + \ No newline at end of file diff --git a/dist/img/icon/file/other.svg b/dist/img/icon/file/other.svg index f3b6f775e3..554bad6b8f 100644 --- a/dist/img/icon/file/other.svg +++ b/dist/img/icon/file/other.svg @@ -1,6 +1,6 @@ - - - - - - + + + + + + \ No newline at end of file diff --git a/dist/img/icon/file/pdf.svg b/dist/img/icon/file/pdf.svg index 03f67c0dfe..a223423d51 100644 --- a/dist/img/icon/file/pdf.svg +++ b/dist/img/icon/file/pdf.svg @@ -1,11 +1,5 @@ - - - - - - - - - - + + + + \ No newline at end of file diff --git a/dist/img/icon/file/presentation.svg b/dist/img/icon/file/presentation.svg index 25d577e83a..2f329bf492 100644 --- a/dist/img/icon/file/presentation.svg +++ b/dist/img/icon/file/presentation.svg @@ -1,5 +1,6 @@ - - - - - + + + + + + \ No newline at end of file diff --git a/dist/img/icon/file/table.svg b/dist/img/icon/file/table.svg index beae11248d..4989c602f9 100644 --- a/dist/img/icon/file/table.svg +++ b/dist/img/icon/file/table.svg @@ -1,9 +1,16 @@ - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + diff --git a/dist/img/icon/file/text.svg b/dist/img/icon/file/text.svg index 1a2324d671..a9689e786b 100644 --- a/dist/img/icon/file/text.svg +++ b/dist/img/icon/file/text.svg @@ -1,7 +1,8 @@ - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/dist/img/icon/file/video.svg b/dist/img/icon/file/video.svg index 2f5fe99ffd..cbd69032f1 100644 --- a/dist/img/icon/file/video.svg +++ b/dist/img/icon/file/video.svg @@ -1,4 +1,5 @@ - - - + + + + \ No newline at end of file diff --git a/dist/img/theme/dark/icon/file/archive.svg b/dist/img/theme/dark/icon/file/archive.svg new file mode 100644 index 0000000000..36b93b9785 --- /dev/null +++ b/dist/img/theme/dark/icon/file/archive.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/dist/img/theme/dark/icon/file/audio.svg b/dist/img/theme/dark/icon/file/audio.svg new file mode 100644 index 0000000000..42c48d6125 --- /dev/null +++ b/dist/img/theme/dark/icon/file/audio.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/dist/img/theme/dark/icon/file/image.svg b/dist/img/theme/dark/icon/file/image.svg new file mode 100644 index 0000000000..cecbf63f4f --- /dev/null +++ b/dist/img/theme/dark/icon/file/image.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/dist/img/theme/dark/icon/file/other.svg b/dist/img/theme/dark/icon/file/other.svg new file mode 100644 index 0000000000..80e41f2d1b --- /dev/null +++ b/dist/img/theme/dark/icon/file/other.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/dist/img/theme/dark/icon/file/pdf.svg b/dist/img/theme/dark/icon/file/pdf.svg new file mode 100644 index 0000000000..54b2b998e2 --- /dev/null +++ b/dist/img/theme/dark/icon/file/pdf.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/dist/img/theme/dark/icon/file/presentation.svg b/dist/img/theme/dark/icon/file/presentation.svg new file mode 100644 index 0000000000..5166935f8a --- /dev/null +++ b/dist/img/theme/dark/icon/file/presentation.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/dist/img/theme/dark/icon/file/table.svg b/dist/img/theme/dark/icon/file/table.svg new file mode 100644 index 0000000000..1a8e3910a0 --- /dev/null +++ b/dist/img/theme/dark/icon/file/table.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dist/img/theme/dark/icon/file/text.svg b/dist/img/theme/dark/icon/file/text.svg new file mode 100644 index 0000000000..373efedc14 --- /dev/null +++ b/dist/img/theme/dark/icon/file/text.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/dist/img/theme/dark/icon/file/video.svg b/dist/img/theme/dark/icon/file/video.svg new file mode 100644 index 0000000000..850da1048d --- /dev/null +++ b/dist/img/theme/dark/icon/file/video.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/scss/component/icon.scss b/src/scss/component/icon.scss index 5d9f2729cc..4f7b588880 100644 --- a/src/scss/component/icon.scss +++ b/src/scss/component/icon.scss @@ -42,16 +42,6 @@ .icon.layout.c-relation { background-image: url('~img/icon/object/relation.svg'); } .icon.layout.c-note { background-image: url('~img/icon/object/note.svg'); } -.icon.iconFile.other { background-image: url('~img/icon/file/other.svg') !important; } -.icon.iconFile.image { background-image: url('~img/icon/file/image.svg') !important; } -.icon.iconFile.video { background-image: url('~img/icon/file/video.svg') !important; } -.icon.iconFile.text { background-image: url('~img/icon/file/text.svg') !important; } -.icon.iconFile.archive { background-image: url('~img/icon/file/archive.svg') !important; } -.icon.iconFile.audio { background-image: url('~img/icon/file/audio.svg') !important; } -.icon.iconFile.pdf { background-image: url('~img/icon/file/pdf.svg') !important; } -.icon.iconFile.presentation { background-image: url('~img/icon/file/presentation.svg') !important; } -.icon.iconFile.table { background-image: url('~img/icon/file/table.svg') !important; } - .icon.view.c0 { background-image: url('~img/icon/dataview/view/grid.svg'); } .icon.view.c1 { background-image: url('~img/icon/dataview/view/list.svg'); } .icon.view.c2 { background-image: url('~img/icon/dataview/view/gallery.svg'); } diff --git a/src/ts/component/util/iconObject.tsx b/src/ts/component/util/iconObject.tsx index 0bca7cdd69..ac8e8a23db 100644 --- a/src/ts/component/util/iconObject.tsx +++ b/src/ts/component/util/iconObject.tsx @@ -90,13 +90,8 @@ const FontSize = { 128: 72, }; -const File = {}; const Relation: any = { small: {}, big: {} }; -for (const key of [ 'other', 'image', 'video', 'text', 'archive', 'audio', 'pdf', 'presentation', 'table' ]) { - File[key] = require(`img/icon/file/${key}.svg`).default; -}; - for (const i in I.RelationType) { const it = Number(i); @@ -251,7 +246,7 @@ const IconObject = observer(class IconObject extends React.Component { icon = ; } else { icn = icn.concat([ 'iconFile', 'c' + iconSize ]); - icon = ; + icon = ; }; break; }; @@ -266,7 +261,7 @@ const IconObject = observer(class IconObject extends React.Component { case I.ObjectLayout.File: { icn = icn.concat([ 'iconFile', 'c' + iconSize ]); - icon = ; + icon = ; break; }; @@ -548,6 +543,22 @@ const IconObject = observer(class IconObject extends React.Component { return name; }; + iconFile (): string { + const type = UtilFile.icon(this.getObject()); + const tc = commonStore.getThemeClass(); + + switch (tc) { + default: + case 'light': { + return require(`img/icon/file/${type}.svg`).default; + }; + + case 'dark': { + return require(`img/theme/dark/icon/file/${type}.svg`).default; + }; + }; + }; + }); export default IconObject; diff --git a/src/ts/lib/util/file.ts b/src/ts/lib/util/file.ts index 6826fde0cf..f48b75b671 100644 --- a/src/ts/lib/util/file.ts +++ b/src/ts/lib/util/file.ts @@ -1,5 +1,6 @@ import loadImage from 'blueimp-load-image'; import { UtilCommon, Relation } from 'Lib'; +import { commonStore } from 'Store'; import Constant from 'json/constant.json'; const SIZE_UNIT = 1024; @@ -108,6 +109,16 @@ class UtilFile { return icon; }; + iconPath (object: any) { + const tp = commonStore.getThemePath(); + return `img/${tp}icon/file/${this.icon(object)}.svg`; + }; + + iconImage (object: any): string { + const tp = commonStore.getThemePath(); + return require(`img/${tp}icon/file/${this.icon(object)}.svg`).default; + }; + loadPreviewCanvas (file: any, param: any, success?: (canvas: any) => void) { if (!file) { return; diff --git a/src/ts/lib/util/graph.ts b/src/ts/lib/util/graph.ts index 9a31a331e9..a61c7857e8 100644 --- a/src/ts/lib/util/graph.ts +++ b/src/ts/lib/util/graph.ts @@ -20,7 +20,7 @@ class UtilGraph { }; case I.ObjectLayout.File: { - src = `img/icon/file/${UtilFile.icon(d)}.svg`; + src = UtilFile.iconPath(d); break; }; @@ -28,7 +28,7 @@ class UtilGraph { if (d.id) { src = commonStore.imageUrl(d.id, 100); } else { - src = `img/icon/file/${UtilFile.icon(d)}.svg`; + src = UtilFile.iconPath(d); }; break; }; diff --git a/src/ts/store/common.ts b/src/ts/store/common.ts index 99857851bb..f070a05968 100644 --- a/src/ts/store/common.ts +++ b/src/ts/store/common.ts @@ -392,6 +392,17 @@ class CommonStore { $(window).trigger('updateTheme'); }; + getThemePath () { + const tc = this.getThemeClass(); + + let tp = ''; + if (tc == 'dark') { + tp = 'theme/dark/'; + }; + + return tp; + }; + nativeThemeSet (isDark: boolean) { this.nativeThemeIsDark = isDark; };