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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 23 additions & 8 deletions js/minirepl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
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!";',
`@define("my-element")
class MyElement {}`,
`element
|> jQuery.parseHTML(match[1], %, true)
|> jQuery.merge(%);`,
`const name = #["Guy Fieri"][0];
const place = #["Flavortown"][0];
#{ "Hello": name, "ready for": place }?
"yes" : "no"`,
`let result = do {
next(yourTurn);
emit("Type some code in here!")
}`,
];

let inEditor;
Expand Down Expand Up @@ -43,7 +51,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 +118,17 @@ 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-decorators", { version: "2023-01" }],
["proposal-pipeline-operator", { proposal: "hack", topicToken: "%" }],
["proposal-record-and-tuple"],
["proposal-do-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