diff --git a/src/components/Md.jsx b/src/components/Md.jsx index 2510359..eefb1ba 100644 --- a/src/components/Md.jsx +++ b/src/components/Md.jsx @@ -12,6 +12,9 @@ class Md extends React.Component { fetch(this.props.path) .then(resp => resp.text()) .then(text => { + if (text.length <= 0) + throw new Error() + this.setState({ md: marked(text) }) }) .catch(err => { @@ -34,7 +37,7 @@ class Md extends React.Component { Md.propTypes = { loader: PropTypes.func, - unloader: PropTypes.func, + unloader: PropTypes.func.isRequired, path: PropTypes.string.isRequired } diff --git a/src/components/SourceOverlay.jsx b/src/components/SourceOverlay.jsx index 452eebf..b9034ff 100644 --- a/src/components/SourceOverlay.jsx +++ b/src/components/SourceOverlay.jsx @@ -7,15 +7,21 @@ import NoSource from './presentational/NoSource' // TODO: move render functions into presentational components function SourceOverlay ({ source, onCancel }) { + function renderError() { + return ( + + ) + } + function renderImage(path) { return (
- } - unloader={} - /> + } + unloader={} + />
) } @@ -45,11 +51,6 @@ function SourceOverlay ({ source, onCancel }) { ) } - function renderError() { - return ( - - ) - } function renderNoSupport(ext) { return (