|  | @@ -1,57 +1,9 @@
 | 
	
		
			
			| 1 | 1 |  import React from 'react'
 | 
	
		
			
			| 2 |  | -import PropTypes from 'prop-types'
 | 
	
		
			
			| 3 |  | -import PopinFixed from '../common/PopinFixed/PopinFixed'
 | 
	
		
			
			| 4 |  | -import PopinFixedHeader from '../common/PopinFixed/PopinFixedHeader.jsx'
 | 
	
		
			
			| 5 |  | -import PopinFixedOption from '../common/PopinFixed/PopinFixedOption.jsx'
 | 
	
		
			
			| 6 |  | -import PopinFixedContent from '../common/PopinFixed/PopinFixedContent.jsx'
 | 
	
		
			
			| 7 |  | -import { FILE_TYPE } from '../../helper.js'
 | 
	
		
			
			| 8 |  | -// import PluginContentType from '../PluginContentType.jsx'
 | 
	
		
			
			| 9 |  | -import PageHtml from '../../plugin/ContentType/PageHtml/PageHtml.jsx'
 | 
	
		
			
			| 10 |  | -// import Thread from '../../plugin/ContentType/Thread/Thread.jsx'
 | 
	
		
			
			| 11 | 2 |  
 | 
	
		
			
			| 12 | 3 |  const FileContentViewer = props => {
 | 
	
		
			
			| 13 |  | -  const defaultPlugin = {
 | 
	
		
			
			| 14 |  | -    customClass: '',
 | 
	
		
			
			| 15 |  | -    icon: '',
 | 
	
		
			
			| 16 |  | -    componentLeft: undefined,
 | 
	
		
			
			| 17 |  | -    componentRight: undefined
 | 
	
		
			
			| 18 |  | -  }
 | 
	
		
			
			| 19 |  | -  const { customClass, icon, componentLeft, componentRight } = FILE_TYPE.find(f => f.name === props.file.type) || defaultPlugin
 | 
	
		
			
			| 20 |  | -
 | 
	
		
			
			| 21 |  | -  const PluginLeft = props => {
 | 
	
		
			
			| 22 |  | -    console.log('componentLeft === PageHtml.name', componentLeft === PageHtml.name)
 | 
	
		
			
			| 23 |  | -    switch (componentLeft) {
 | 
	
		
			
			| 24 |  | -      case PageHtml.name:
 | 
	
		
			
			| 25 |  | -        return <PageHtml version={props.file.version} text={props.file.text} />
 | 
	
		
			
			| 26 |  | -    }
 | 
	
		
			
			| 27 |  | -    // componentLeft is a string, I cant do <componentLeft /> because it needs to be a react object (component) like PageHtml is
 | 
	
		
			
			| 28 |  | -  }
 | 
	
		
			
			| 29 |  | -
 | 
	
		
			
			| 30 | 4 |    return (
 | 
	
		
			
			| 31 |  | -    <PopinFixed customClass={`${customClass}`}>
 | 
	
		
			
			| 32 |  | -      <PopinFixedHeader
 | 
	
		
			
			| 33 |  | -        customClass={`${customClass}`}
 | 
	
		
			
			| 34 |  | -        icon={icon}
 | 
	
		
			
			| 35 |  | -        name={props.file.title}
 | 
	
		
			
			| 36 |  | -        onClickCloseBtn={props.onClose}
 | 
	
		
			
			| 37 |  | -      />
 | 
	
		
			
			| 38 |  | -
 | 
	
		
			
			| 39 |  | -      <PopinFixedOption customClass={`${customClass}`} />
 | 
	
		
			
			| 40 | 5 |  
 | 
	
		
			
			| 41 |  | -      <PopinFixedContent customClass={`${customClass}__contentpage`}>
 | 
	
		
			
			| 42 |  | -        {/* <PluginContentType customeClass={customClass} file={props.file} /> */}
 | 
	
		
			
			| 43 |  | -        <PluginLeft file={props.file} />
 | 
	
		
			
			| 44 |  | -      </PopinFixedContent>
 | 
	
		
			
			| 45 |  | -    </PopinFixed>
 | 
	
		
			
			| 46 | 6 |    )
 | 
	
		
			
			| 47 | 7 |  }
 | 
	
		
			
			| 48 | 8 |  
 | 
	
		
			
			| 49 | 9 |  export default FileContentViewer
 | 
	
		
			
			| 50 |  | -
 | 
	
		
			
			| 51 |  | -FileContentViewer.PropTypes = {
 | 
	
		
			
			| 52 |  | -  file: PropTypes.shape({
 | 
	
		
			
			| 53 |  | -    type: PropTypes.oneOf(FILE_TYPE.map(f => f.name)).isRequired,
 | 
	
		
			
			| 54 |  | -    title: PropTypes.string.isRequired
 | 
	
		
			
			| 55 |  | -  }).isRequired,
 | 
	
		
			
			| 56 |  | -  onClose: PropTypes.func.isRequired
 | 
	
		
			
			| 57 |  | -}
 |