diff --git a/package.json b/package.json index 225718b..2b51ff6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-loading-iframe", - "version": "1.0.4", + "version": "1.1.0", "description": "", "source": "src/index.tsx", "main": "dist/main.js", diff --git a/src/index.tsx b/src/index.tsx index b32fc39..2d60ad7 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,5 +1,6 @@ import * as React from "react"; import { + Fragment, FunctionComponent, IframeHTMLAttributes, ReactElement, @@ -11,6 +12,7 @@ interface Props extends IframeHTMLAttributes { skeleton?: ReactElement; } +/** An iframe that takes a skeleton as a prop and renders the skeleton until the iframe is ready */ const LoadingIframe: FunctionComponent = (props) => { const { skeleton, className, ...iframeProps } = props; const [iframeLoading, setIframeLoading] = useState(true); @@ -22,9 +24,10 @@ const LoadingIframe: FunctionComponent = (props) => { } return ( -
+ {iframeLoading && skeleton}