Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added custom loading prop
  • Loading branch information
OFCL08 committed Jul 31, 2021
commit bd510e00a2425a76afd6a4f87f7f2c53ec09159f
8 changes: 5 additions & 3 deletions src/components/file-viewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,18 @@ class FileViewer extends Component {
}

FileViewer.propTypes = {
fileType: PropTypes.string.isRequired,
errorComponent: PropTypes.element,
filePath: PropTypes.string.isRequired,
fileType: PropTypes.string.isRequired,
loadingComponent: PropTypes.element,
onError: PropTypes.func,
errorComponent: PropTypes.element,
unsupportedComponent: PropTypes.element,
};

FileViewer.defaultProps = {
onError: () => null,
errorComponent: null,
loadingComponent: null,
onError: () => null,
unsupportedComponent: null,
};

Expand Down
4 changes: 3 additions & 1 deletion src/components/loading.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import 'styles/loading.scss';

const Loading = () => (
<div className="loading-container">
<span className="loading" />
{props.loadingComponent
? <props.loadingComponent {...props} />
: <span className="loading" />}
</div>
);

Expand Down