From 9e0333c2df304526816db54a230c803c429f21f1 Mon Sep 17 00:00:00 2001 From: Omar Flores Grimontt Date: Thu, 12 Sep 2019 16:34:23 -0500 Subject: [PATCH] added preloader validation --- package.json | 2 +- src/components/Viewer.jsx | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 5574d0b..e46bd86 100644 --- a/package.json +++ b/package.json @@ -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, diff --git a/src/components/Viewer.jsx b/src/components/Viewer.jsx index 5e5584d..c39a4ec 100644 --- a/src/components/Viewer.jsx +++ b/src/components/Viewer.jsx @@ -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 { @@ -23,8 +24,18 @@ export const Viewer = props => { pageSize, showPdfMenu, onPrint, + isLoading, } = props + if (isLoading) { + return ( + + ) + } + switch (type) { case 'csv': { return ( @@ -141,6 +152,7 @@ Viewer.propTypes = { showPdfMenu: bool, onPrint: func, className: string, + isLoading: bool, } Viewer.defaultProps = { @@ -154,4 +166,5 @@ Viewer.defaultProps = { showPdfMenu: true, onPrint: null, className: null, + isLoading: false, }