Skip to content

Commit 0cfef8a

Browse files
committed
Experiment: change dynamic loading on /try page level
1 parent 4c54fca commit 0cfef8a

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

common/CodeMirrorBase.re

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import "../styles/cm.css";
1515
1616
if (typeof window !== "undefined" && typeof window.navigator !== "undefined") {
1717
require("codemirror/mode/javascript/javascript");
18+
require("codemirror/addon/scroll/simplescrollbars");
1819
require("../plugins/cm-reason-mode");
1920
}
2021
|};
@@ -38,6 +39,10 @@ module CM = {
3839
readOnly: bool,
3940
[@bs.optional]
4041
lineWrapping: bool,
42+
[@bs.optional]
43+
fixedGutter: bool,
44+
[@bs.optional]
45+
scrollbarStyle: string,
4146
};
4247
};
4348

@@ -385,9 +390,11 @@ let default = (props: Props.t): React.element => {
385390
cmOptions->CM.Options.lineWrapping,
386391
false,
387392
),
393+
~fixedGutter=false,
388394
~readOnly=
389395
Belt.Option.getWithDefault(cmOptions->CM.Options.readOnly, false),
390396
~lineNumbers=true,
397+
~scrollbarStyle="overlay",
391398
(),
392399
);
393400
let cm = CM.fromTextArea(input, options);

components/CodeMirror.re

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@ let make =
6262
(),
6363
);
6464

65-
React.createElement(dynamicComponent, props);
65+
/*React.createElement(dynamicComponent, props);*/
66+
CodeMirrorBase.default(props);
6667
};

pages/try.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
export { default } from "../re_pages/Playground.bs";
1+
import dynamic from "next/dynamic";
2+
3+
const Playground = dynamic(() => import("../re_pages/Playground.bs"), {
4+
ssr: false,
5+
//loading: () => <div> Loading... </div>
6+
});
7+
8+
export default Playground;

0 commit comments

Comments
 (0)