import { h, Component } from 'preact'; import PropTypes from 'prop-types'; import CodeEditor from './codeEditor'; import GithubRepo from './githubRepo'; import ChannelDetails from './channelDetails'; import UserDetails from './userDetails'; import Article from './article'; export default class Content extends Component { static propTypes = { resource: PropTypes.object, activeChannelId: PropTypes.number, pusherKey: PropTypes.string, }; render() { if (!this.props.resource) { return ''; } return (
{display(this.props)}
); } } function display(props) { if (props.resource.type_of === 'loading-user') { return (
); } if (props.resource.type_of === 'loading-user') { return (
); } if (props.resource.type_of === 'user') { return ( ); } if (props.resource.type_of === 'article') { return
; } if (props.resource.type_of === 'github') { return ( ); } if (props.resource.type_of === 'chat_channel') { return ( ); } if (props.resource.type_of === 'code_editor') { return ( ); } }