begin refactor to 0.4
, not successful yet
This commit is contained in:
parent
f01ffa806e
commit
7e6d3a32db
18
components/DynamicSquiggleEditor.tsx
Normal file
18
components/DynamicSquiggleEditor.tsx
Normal file
|
@ -0,0 +1,18 @@
|
|||
import React from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
const SquiggleEditor = dynamic<any>(
|
||||
() => import("@quri/squiggle-components").then((mod) => mod.SquiggleEditor),
|
||||
{
|
||||
loading: () => <p>Loading...</p>,
|
||||
ssr: false,
|
||||
}
|
||||
)
|
||||
|
||||
export function DynamicSquiggleEditor( props: any ) {
|
||||
return (
|
||||
<SquiggleEditor
|
||||
defaultCode={props.defaultCode}
|
||||
/>
|
||||
)
|
||||
};
|
|
@ -1,20 +0,0 @@
|
|||
import React from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
const SquiggleEditorWithImportedBindings = dynamic<any>(
|
||||
() => import("@quri/squiggle-components").then((mod) => mod.SquiggleEditorWithImportedBindings),
|
||||
{
|
||||
loading: () => <p>Loading...</p>,
|
||||
ssr: false,
|
||||
}
|
||||
)
|
||||
|
||||
export function DynamicSquiggleEditorWithImportedBindings( props: any ) {
|
||||
return (
|
||||
<SquiggleEditorWithImportedBindings
|
||||
defaultCode={props.defaultCode}
|
||||
showSummary={true}
|
||||
bindingsImportUrl={props.bindingsImportUrl}
|
||||
/>
|
||||
)
|
||||
};
|
|
@ -10,7 +10,7 @@ export default function Layout({ children }: Props) {
|
|||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>GUCEM</title>
|
||||
<title>squiggle-next-template</title>
|
||||
<meta name="description" content="Generated by create next app" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
</Head>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"private": true,
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { DynamicSquiggleEditorWithImportedBindings as SquiggleEditor } from "../components/DynamicSquiggleEditorWithImportedBindings"
|
||||
import { DynamicSquiggleEditor as SquiggleEditor } from "../components/DynamicSquiggleEditor"
|
||||
|
||||
# Squiggle demonstration
|
||||
|
||||
|
@ -13,6 +13,10 @@ f(z)`} />
|
|||
|
||||
We can also import assignments from files that live in `/public/estimates/` of the repo.
|
||||
|
||||
<SquiggleEditor defaultCode="foo.bar(beta(1,2), ski)" bindingsImportUrl="/estimates/baz.squiggle" />
|
||||
<SquiggleEditor
|
||||
defaultCode={`
|
||||
@import(estimates/baz.squiggle, baz)
|
||||
baz.foo.bar(beta(1,2), baz.ski)`}
|
||||
/>
|
||||
|
||||
Files you import for bindings have to consist only of assignments: they cannot end in an expression, unless that expression is a record.
|
||||
|
|
Loading…
Reference in New Issue
Block a user