2018-11-06 03:57:51 +00:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import CodePreview from './CodePreview';
|
|
|
|
import TerminalPreview from './TerminalPreview';
|
|
|
|
import Tabs from './Tabs';
|
2018-12-20 04:00:18 +00:00
|
|
|
import styles from './TextPreviews.module.css';
|
2018-11-06 03:57:51 +00:00
|
|
|
|
|
|
|
export default class TextPreviews extends PureComponent {
|
|
|
|
|
|
|
|
state = { activePreview: 'code' };
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Tabs>
|
|
|
|
{ ({ tabClassName, getTabStyle, contentClassName, contentStyle }) => (
|
2018-12-20 04:00:18 +00:00
|
|
|
<div className={ styles.wrapper }>
|
2018-11-06 03:57:51 +00:00
|
|
|
<div>
|
|
|
|
<button
|
|
|
|
className={ tabClassName }
|
|
|
|
style={ getTabStyle(this.state.activePreview === 'code') }
|
|
|
|
onClick={ () => this.setState({ activePreview: 'code' }) }
|
|
|
|
>Code</button>
|
|
|
|
<button
|
|
|
|
className={ tabClassName }
|
|
|
|
style={ getTabStyle(this.state.activePreview === 'terminal') }
|
|
|
|
onClick={ () => this.setState({ activePreview: 'terminal' }) }
|
|
|
|
>Terminal</button>
|
|
|
|
</div>
|
2018-11-24 18:29:07 +00:00
|
|
|
<div className={ contentClassName } style={ contentStyle }>
|
2018-11-06 03:57:51 +00:00
|
|
|
{ this.state.activePreview === 'code' ? (
|
|
|
|
<CodePreview />
|
|
|
|
) : null }
|
|
|
|
{ this.state.activePreview === 'terminal' ? (
|
|
|
|
<TerminalPreview />
|
|
|
|
) : null }
|
|
|
|
</div>
|
2018-11-24 18:29:07 +00:00
|
|
|
</div>
|
2018-11-06 03:57:51 +00:00
|
|
|
) }
|
|
|
|
</Tabs>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|