Skip to content

Commit

Permalink
[docs] Disabled stackblitz for TS demos
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Oct 22, 2018
1 parent 271fe58 commit 60b2061
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions docs/src/modules/components/Demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import JSLogo from '@material-ui/docs/svgIcons/JSLogo';
import TSLogo from '@material-ui/docs/svgIcons/TSLogo';
import MarkdownElement from '@material-ui/docs/MarkdownElement';
import DemoFrame from 'docs/src/modules/components/DemoFrame';
import getDemo from 'docs/src/modules/utils/codesandboxDemoConfig';
import getDemo from 'docs/src/modules/utils/demoConfig';
import TSCodeBadge from 'docs/src/modules/components/TSCodeBadge';

function compress(object) {
Expand Down Expand Up @@ -168,7 +168,8 @@ class Demo extends React.Component {
};

handleClickStackBlitz = () => {
const demo = getDemo(this.props);
const { codeLanguage } = this.state;
const demo = getDemo(this.props, codeLanguage);
const form = document.createElement('form');
form.method = 'POST';
form.target = '_blank';
Expand All @@ -177,6 +178,7 @@ class Demo extends React.Component {
addHiddenInput(form, 'project[title]', demo.title);
addHiddenInput(form, 'project[description]', demo.description);
addHiddenInput(form, 'project[dependencies]', JSON.stringify(demo.dependencies));
addHiddenInput(form, 'project[devDependencies]', JSON.stringify(demo.devDependencies));
Object.entries(demo.files).forEach(([key, value]) => {
addHiddenInput(form, `project[files][${key}]`, value);
});
Expand Down Expand Up @@ -300,7 +302,9 @@ class Demo extends React.Component {
>
<MenuItem onClick={this.handleClickCopy}>Copy the source</MenuItem>
{demoOptions.hideEditButton ? null : (
<MenuItem onClick={this.handleClickStackBlitz}>Edit in StackBlitz</MenuItem>
<MenuItem disabled={codeLanguage === 'TS'} onClick={this.handleClickStackBlitz}>
Edit in StackBlitz (JS only)
</MenuItem>
)}
</Menu>
</div>
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@
"@types/prop-types" "*"
csstype "^2.2.0"

"@types/react@^16.3.14":
"@types/react@^16.4.17":
version "16.4.18"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.4.18.tgz#2e28a2e7f92d3fa7d6a65f2b73275c3e3138a13d"
integrity sha512-eFzJKEg6pdeaukVLVZ8Xb79CTl/ysX+ExmOfAAqcFlCCK5TgFDD9kWR0S18sglQ3EmM8U+80enjUqbfnUyqpdA==
Expand Down

0 comments on commit 60b2061

Please sign in to comment.