Skip to content

Commit 9e0333c

Browse files
author
Omar Flores Grimontt
committed
added preloader validation
1 parent 551e829 commit 9e0333c

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@omarefg/react-file-preview",
3-
"version": "0.1.12",
3+
"version": "0.1.13",
44
"description": "Component to render and preview some kind of documents",
55
"main": "lib/index.js",
66
"private": false,

src/components/Viewer.jsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { Video } from './Video'
88
import { Unssuported } from './Unsupported'
99
import { Csv } from './Csv'
1010
import { Xlsx } from './Xlsx'
11+
import { Loader } from './Loader'
1112

1213
export const Viewer = props => {
1314
const {
@@ -23,8 +24,18 @@ export const Viewer = props => {
2324
pageSize,
2425
showPdfMenu,
2526
onPrint,
27+
isLoading,
2628
} = props
2729

30+
if (isLoading) {
31+
return (
32+
<Loader
33+
ErrorComponent={ErrorComponent}
34+
onError={onError}
35+
/>
36+
)
37+
}
38+
2839
switch (type) {
2940
case 'csv': {
3041
return (
@@ -141,6 +152,7 @@ Viewer.propTypes = {
141152
showPdfMenu: bool,
142153
onPrint: func,
143154
className: string,
155+
isLoading: bool,
144156
}
145157

146158
Viewer.defaultProps = {
@@ -154,4 +166,5 @@ Viewer.defaultProps = {
154166
showPdfMenu: true,
155167
onPrint: null,
156168
className: null,
169+
isLoading: false,
157170
}

0 commit comments

Comments
 (0)