Skip to content

Commit

Permalink
Undo changes to GuideSection.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcenizal committed Jan 6, 2018
1 parent 17df52c commit 78e1936
Showing 1 changed file with 3 additions and 31 deletions.
34 changes: 3 additions & 31 deletions src-docs/src/components/guide_section/guide_section.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

import {
GuideSandboxChrome,
} from '..';

import {
EuiButtonIcon,
EuiCodeBlock,
EuiErrorBoundary,
EuiSpacer,
Expand Down Expand Up @@ -40,7 +38,6 @@ export class GuideSection extends Component {
sandbox: {
isChromeVisible: props.isSandbox ? false : undefined,
},
isCodeFullScreen: false,
};
}

Expand All @@ -50,12 +47,6 @@ export class GuideSection extends Component {
});
}

onToggleCodeFullScreen = () => {
this.setState({
isCodeFullScreen: !this.state.isCodeFullScreen,
});
};

onToggleSandboxChrome = () => {
this.setState({
sandbox: {
Expand All @@ -64,14 +55,6 @@ export class GuideSection extends Component {
});
}

componentWillUpdate(nextProps, nextState) {
if (nextState.isCodeFullScreen) {
document.body.classList.add('euiBody-hasOverlayMask');
} else {
document.body.classList.remove('euiBody-hasOverlayMask');
}
}

renderTabs() {
return this.tabs.map(tab => (
<EuiTab
Expand Down Expand Up @@ -131,26 +114,15 @@ export class GuideSection extends Component {

const codeClass = nameToCodeClassMap[name];
const source = this.props.source.find(sourceObject => sourceObject.type === name);
const classes = classNames('guideCode', {
'guideCode-isExpanded': this.state.isCodeFullScreen,
});

return (
<div key={name} ref={name} className={classes}>
<div key={name} ref={name} className="guideCode">
<EuiCodeBlock
language={codeClass}
overflowHeight={this.state.isCodeFullScreen ? '100vh' : 400}
overflowHeight={400}
>
{source.code}
</EuiCodeBlock>

<EuiButtonIcon
className="guideCodeFullScreenButton"
size="s"
onClick={this.onToggleCodeFullScreen}
iconType={this.state.isCodeFullScreen ? 'cross' : 'expand'}
aria-label="Expand"
/>
</div>
);
}
Expand All @@ -171,7 +143,7 @@ export class GuideSection extends Component {
}

render() {
const chrome = this.state.isCodeFullScreen ? undefined : this.renderChrome();
const chrome = this.renderChrome();

return (
<div className="guideSection" id={this.props.id}>
Expand Down

0 comments on commit 78e1936

Please sign in to comment.