add example + only show scrollbars in Chrome when necessary

This commit is contained in:
Joeri Exelmans 2025-05-17 12:13:44 +02:00
parent 51ff4d24b0
commit 68104a8102
3 changed files with 54 additions and 2 deletions

View file

@ -24,7 +24,7 @@ nav {
main {
grid-area: content;
overflow: scroll;
overflow: auto;
}
aside {

View file

@ -3,7 +3,7 @@ import './App.css';
import { CommandContext } from './CommandContext';
import { Editor, type EditorState } from './Editor';
import { extendedEnv } from './EnvContext';
import { biggerExample, initialEditorState, nonEmptyEditorState, tripleFunctionCallEditorState } from "./configurations";
import { biggerExample, initialEditorState, lambda2Params, nonEmptyEditorState, tripleFunctionCallEditorState } from "./configurations";
import { evalEditorBlock } from "./eval";
const commands: [string, string[], string][] = [
@ -19,6 +19,7 @@ const examples: [string, EditorState][] = [
["push to list", nonEmptyEditorState],
["function w/ 4 params", tripleFunctionCallEditorState],
["bigger example", biggerExample],
["lambda 2 params", lambda2Params],
];
type AppState = {

View file

@ -252,4 +252,55 @@ export const biggerExample: EditorState = {
}
}
}
};
export const lambda2Params: EditorState = {
"kind": "let",
"inner": {
"kind": "input",
"text": "",
"value": {
"kind": "text"
},
"focus": false
},
"name": "myAddInt",
"value": {
"kind": "lambda",
"paramName": "x",
"expr": {
"kind": "lambda",
"paramName": "y",
"expr": {
"kind": "call",
"fn": {
"kind": "call",
"fn": {
"kind": "input",
"text": "addInt",
"value": {
"kind": "name"
},
"focus": false
},
"input": {
"kind": "input",
"text": "x",
"value": {
"kind": "name"
},
"focus": false
}
},
"input": {
"kind": "input",
"text": "y",
"value": {
"kind": "name"
},
"focus": false
}
}
}
}
};