Skip to content

Commit

Permalink
added preloader validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Omar Flores Grimontt committed Sep 12, 2019
1 parent 551e829 commit 9e0333c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@omarefg/react-file-preview",
"version": "0.1.12",
"version": "0.1.13",
"description": "Component to render and preview some kind of documents",
"main": "lib/index.js",
"private": false,
Expand Down
13 changes: 13 additions & 0 deletions src/components/Viewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Video } from './Video'
import { Unssuported } from './Unsupported'
import { Csv } from './Csv'
import { Xlsx } from './Xlsx'
import { Loader } from './Loader'

export const Viewer = props => {
const {
Expand All @@ -23,8 +24,18 @@ export const Viewer = props => {
pageSize,
showPdfMenu,
onPrint,
isLoading,
} = props

if (isLoading) {
return (
<Loader
ErrorComponent={ErrorComponent}
onError={onError}
/>
)
}

switch (type) {
case 'csv': {
return (
Expand Down Expand Up @@ -141,6 +152,7 @@ Viewer.propTypes = {
showPdfMenu: bool,
onPrint: func,
className: string,
isLoading: bool,
}

Viewer.defaultProps = {
Expand All @@ -154,4 +166,5 @@ Viewer.defaultProps = {
showPdfMenu: true,
onPrint: null,
className: null,
isLoading: false,
}

0 comments on commit 9e0333c

Please sign in to comment.