react-syntax-highlighter: add async build types (#35470)

This commit is contained in:
Guo Yunhe
2019-05-20 14:19:08 -07:00
committed by Ryan Cavanaugh
parent 09505a25ab
commit 2e1423b993
2 changed files with 661 additions and 416 deletions
File diff suppressed because it is too large Load Diff
@@ -1,8 +1,8 @@
import * as React from "react";
import SyntaxHighlighter from "react-syntax-highlighter";
import PrismSyntaxHighlighter from "react-syntax-highlighter/prism";
import PrismLightHighlighter, { registerLanguage } from "react-syntax-highlighter/prism-light";
import jsx from 'react-syntax-highlighter/languages/prism/jsx';
import PrismLightHighlighter from "react-syntax-highlighter/prism-light";
import jsx from "react-syntax-highlighter/languages/prism/jsx";
import { docco } from "react-syntax-highlighter/dist/styles/hljs";
import { atomDark } from "react-syntax-highlighter/dist/styles/prism";
@@ -53,13 +53,13 @@ function primsLightHighlighter(): JSX.Element {
}
}
`;
registerLanguage('jsx', jsx);
PrismLightHighlighter.registerLanguage("jsx", jsx);
return (
<PrismLightHighlighter language="jsx" style={atomDark}>
{codeString}
</PrismLightHighlighter>
)
);
}
function codeTagProps() {
@@ -75,17 +75,14 @@ function codeTagProps() {
`;
const codeTagProps = {
className: 'some-classname',
className: "some-classname",
style: {
opacity: 0,
opacity: 0
},
onMouseOver: (event: React.MouseEvent<HTMLElement>) => "foo",
}
onMouseOver: (event: React.MouseEvent<HTMLElement>) => "foo"
};
return (
<PrismLightHighlighter
codeTagProps={codeTagProps} />
)
return <PrismLightHighlighter codeTagProps={codeTagProps} />;
}
function linePropsObject() {
@@ -99,20 +96,17 @@ function linePropsObject() {
}
}
`;
const lineProps = {
otherProp: 'otherProp',
className: 'some-classname',
otherProp: "otherProp",
className: "some-classname",
style: {
opacity: 0,
opacity: 0
},
onMouseOver: (event: React.MouseEvent<HTMLElement>) => "foo"
}
};
return (
<PrismLightHighlighter
lineProps={lineProps} />
)
return <PrismLightHighlighter lineProps={lineProps} />;
}
function lineTagPropsFunction() {
@@ -126,19 +120,15 @@ function lineTagPropsFunction() {
}
}
`;
const lineProps = (lineNumber: number) => ({
otherProp: 'otherProp',
className: 'some-classname',
otherProp: "otherProp",
className: "some-classname",
style: {
opacity: 0,
opacity: 0
},
onMouseOver: (event: React.MouseEvent<HTMLElement>) => lineNumber * 5
})
});
return (
<PrismLightHighlighter
lineProps={lineProps} />
)
return <PrismLightHighlighter lineProps={lineProps} />;
}