No antd and everything compiles

Value: [1e-3 to 3e-2]
This commit is contained in:
Quinn Dougherty 2022-04-28 17:54:43 -04:00
parent 8c59ad0ff1
commit fde75d4bc3
3 changed files with 21 additions and 10 deletions

View File

@ -3,9 +3,8 @@
"version": "0.2.13", "version": "0.2.13",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"antd": "^4.20.1",
"react-ace": "10.1.0", "react-ace": "10.1.0",
"@quri/squiggle-lang": "^0.2.6", "@quri/squiggle-lang": "^0.2.7",
"react-dom": "^18.1.0", "react-dom": "^18.1.0",
"vega": "^5.22.1", "vega": "^5.22.1",
"vega-embed": "^6.20.6", "vega-embed": "^6.20.6",

View File

@ -1,11 +1,11 @@
import _ from "lodash"; import _ from "lodash";
import React, { FC, useState } from "react"; import React, { FC, ReactElement, useState } from "react";
import ReactDOM from "react-dom"; import ReactDOM from "react-dom";
import { SquiggleChart } from "./SquiggleChart"; import { SquiggleChart } from "./SquiggleChart";
import CodeEditor from "./CodeEditor"; import CodeEditor from "./CodeEditor";
import { Form, Input, Row, Col } from "antd"; // import { Form, Input, Row, Col } from "antd";
import styled from "styled-components"; import styled from "styled-components";
import "antd/dist/antd.css"; // import "antd/dist/antd.css";
interface FieldFloatProps { interface FieldFloatProps {
label: string; label: string;
@ -14,10 +14,19 @@ interface FieldFloatProps {
onChange: (value: number) => void; onChange: (value: number) => void;
} }
const Input = styled.input``
const FormItem = (props: {label:string, children:ReactElement}) => (
<div>
<label>{props.label}</label>
{props.children}
</div>
)
function FieldFloat(Props: FieldFloatProps) { function FieldFloat(Props: FieldFloatProps) {
let [contents, setContents] = useState(Props.value + ""); let [contents, setContents] = useState(Props.value + "");
return ( return (
<Form.Item label={Props.label}> <FormItem label={Props.label}>
<Input <Input
value={contents} value={contents}
className={Props.className ? Props.className : ""} className={Props.className ? Props.className : ""}
@ -29,7 +38,7 @@ function FieldFloat(Props: FieldFloatProps) {
} }
}} }}
/> />
</Form.Item> </FormItem>
); );
} }
@ -65,6 +74,9 @@ const Display = styled.div<TitleProps>`
max-height: ${(props) => props.maxHeight}px; max-height: ${(props) => props.maxHeight}px;
`; `;
const Row = styled.div``
const Col = styled.div``
let SquigglePlayground: FC<Props> = ({ let SquigglePlayground: FC<Props> = ({
initialSquiggleString = "", initialSquiggleString = "",
height = 300, height = 300,
@ -79,7 +91,7 @@ let SquigglePlayground: FC<Props> = ({
return ( return (
<ShowBox height={height}> <ShowBox height={height}>
<Row> <Row>
<Col span={12}> <Col>
<CodeEditor <CodeEditor
value={squiggleString} value={squiggleString}
onChange={setSquiggleString} onChange={setSquiggleString}
@ -88,7 +100,7 @@ let SquigglePlayground: FC<Props> = ({
height={height - 3} height={height - 3}
/> />
</Col> </Col>
<Col span={12}> <Col>
<Display maxHeight={height - 3}> <Display maxHeight={height - 3}>
<SquiggleChart <SquiggleChart
squiggleString={squiggleString} squiggleString={squiggleString}

View File

@ -5005,7 +5005,7 @@ ansi-to-html@^0.6.11:
dependencies: dependencies:
entities "^2.0.0" entities "^2.0.0"
antd@^4.20.0, antd@^4.20.1: antd@^4.20.0:
version "4.20.1" version "4.20.1"
resolved "https://registry.yarnpkg.com/antd/-/antd-4.20.1.tgz#6cd5a406c7172d61a5d0693ea52ee908650cf674" resolved "https://registry.yarnpkg.com/antd/-/antd-4.20.1.tgz#6cd5a406c7172d61a5d0693ea52ee908650cf674"
integrity sha512-asKxOV0a6AijqonbcXkO08/q+XvqS/HmGfaRIS6ZH1ALR3FS2q+kTW52rJZO9rfoOb/ldPhEBVSWiNrbiB+uCQ== integrity sha512-asKxOV0a6AijqonbcXkO08/q+XvqS/HmGfaRIS6ZH1ALR3FS2q+kTW52rJZO9rfoOb/ldPhEBVSWiNrbiB+uCQ==