Add new loading component (#1855)
This commit is contained in:
1 parent
920c3e9455
commit
849c8a6ae1
2 files changed
+43
No files matched your search
@@ -13,6 +13,7 @@ import {
|
|||||||
import { useTrackedMeasurements } from './../getContextModule';
|
import { useTrackedMeasurements } from './../getContextModule';
|
||||||
|
|
||||||
import ViewportOverlay from './ViewportOverlay';
|
import ViewportOverlay from './ViewportOverlay';
|
||||||
|
import ViewportLoadingIndicator from './ViewportLoadingIndicator';
|
||||||
|
|
||||||
const { formatDate } = utils;
|
const { formatDate } = utils;
|
||||||
|
|
||||||
@@ -297,6 +298,7 @@ function TrackedCornerstoneViewport({
|
|||||||
isPlaying={false}
|
isPlaying={false}
|
||||||
frameRate={24}
|
frameRate={24}
|
||||||
isOverlayVisible={true}
|
isOverlayVisible={true}
|
||||||
|
loadingIndicatorComponent={ViewportLoadingIndicator}
|
||||||
viewportOverlayComponent={props => {
|
viewportOverlayComponent={props => {
|
||||||
return (
|
return (
|
||||||
<ViewportOverlay
|
<ViewportOverlay
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
const ViewportLoadingIndicator = ({ error }) => {
|
||||||
|
if (error) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="bg-black h-full w-full absolute opacity-50"></div>
|
||||||
|
<div className="text-primary-light text-xl font-thin">
|
||||||
|
<h4>Error Loading Image</h4>
|
||||||
|
<p>An error has occurred.</p>
|
||||||
|
<p>{error.message}</p>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="bg-black h-full w-full absolute opacity-50"></div>
|
||||||
|
<div className="absolute transparent w-full h-full flex items-center justify-center">
|
||||||
|
<p className="text-primary-light text-xl font-thin">
|
||||||
|
Loading...
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
ViewportLoadingIndicator.propTypes = {
|
||||||
|
percentComplete: PropTypes.number,
|
||||||
|
error: PropTypes.object,
|
||||||
|
};
|
||||||
|
|
||||||
|
ViewportLoadingIndicator.defaultProps = {
|
||||||
|
percentComplete: 0,
|
||||||
|
error: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ViewportLoadingIndicator;
|
||||||
Reference in new issue
Block a user