Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update landing page examples #2750

Merged
merged 3 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions js/minirepl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import debounce from "lodash.debounce";

const miniReplExamples = [
"element.index ?? -1;",
"const styles = {\n" + " ...defaults,\n" + ' color: "#f5da55",\n' + "};",
"const city = address?.city",
'var name = "Guy Fieri";\nvar place = "Flavortown";\n\n`Hello ${name}, ready for ${place}?`;',
'let yourTurn = "Type some code in here!";',
"/(?i:a)b/",
`using Flavortown = from(#["Guy Fieri"]);`,
// use next(yourTurn) = throw "some code in here!"
// when we support extractors
`let yourTurn = throw "some code in here!"`,
];

let inEditor;
Expand Down Expand Up @@ -43,7 +43,7 @@ function setupEditor(id, readOnly) {
tabSize: 2,
useSoftTabs: true,
useWorker: false,
wrap: false,
wrap: true,
});

editor.renderer.setPadding(24);
Expand Down Expand Up @@ -110,10 +110,16 @@ function compileCode(sourceEditor, targetEditor) {
transformed = Babel.transform(sourceEditor.getValue(), {
presets: [
"react",
"typescript",
["env", { targets: "defaults, not ie 11, not ie_mob 11", loose: true }],
],
plugins: [["external-helpers", { helperVersion: "7.100.0" }]],
filename: "repl",
plugins: [
["external-helpers", { helperVersion: "7.100.0" }],
["proposal-explicit-resource-management"],
["proposal-record-and-tuple"],
["proposal-throw-expressions"],
],
filename: "repl.tsx",
babelrc: false,
});
} catch (e) {
Expand Down
7 changes: 1 addition & 6 deletions website/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useEffect } from "react";
import "../../static/css/index.css";
import "../../static/css/minirepl.css";
import "../../../js/minirepl.js";
import Link from "@docusaurus/Link";
import BABEL_MINI_REPL from "../../../js/minirepl.js";
import Translate from "@docusaurus/Translate";
Expand Down Expand Up @@ -152,9 +151,6 @@ const ocButton = {
};

const OpenCollectiveSponsors = ({ language }) => {
const { siteConfig } = useDocusaurusContext();
const { customFields } = siteConfig;

return (
<div className="container paddingBottom">
<div className="wrapper productShowcaseSection">
Expand Down Expand Up @@ -236,9 +232,8 @@ const Hero = ({ language }) => (

const Index = ({ language }) => {
const { siteConfig } = useDocusaurusContext();
const { customFields } = siteConfig;
return (
<Layout title={siteConfig?.title} description={siteConfig?.tagline}>
<Layout title={siteConfig.title} description={siteConfig.tagline}>
<div>
<Hero language={language} />

Expand Down