add support for markdown text files

This commit is contained in:
Lachlan Kermode
2019-01-03 13:04:55 +00:00
parent b60d3053c7
commit 5552aa563f
7 changed files with 74 additions and 24 deletions

View File

@@ -1,8 +1,10 @@
import React from 'react'
import Img from 'react-image'
import { Player } from 'video-react'
import Md from './Md.jsx'
import Spinner from './presentational/Spinner'
import NoSource from './presentational/NoSource'
// TODO: move render functions into presentational components
function SourceOverlay ({ source, onCancel }) {
function renderImage(path) {
@@ -32,26 +34,17 @@ function SourceOverlay ({ source, onCancel }) {
}
function renderText(path) {
return (<div>{path}</div>)
return (
<div className='source-text-container'>
<Md
path={path}
loader={<Spinner />}
unloader={renderError()}
/>
</div>
)
}
// renderImagebook() {
// return (
// <div className='source-image-container'>
// {source.paths.map((url, idx) => (
// <Img
// key={idx}
// className='source-image'
// src={url}
// loader={<Spinner />}
// unloader={<NoSource failedUrls={[source.path]} />}
// />
//
// ))}
// </div>
// )
// }
function renderError() {
return (
<NoSource failedUrls={["NOT ALL SOURCES AVAILABLE IN APPLICATION YET"]} />