From 1251d35b94d64b7f34d5dd16eab8e7493b0c966c Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Mon, 7 Feb 2022 21:13:03 +0200 Subject: Add tests, do things --- src/App.module.css | 19 +++++++++++++++++ src/App.tsx | 19 ++++++++++++++++- src/Editor.tsx | 61 ++++++++++++++++++++++++++++++++++++++++-------------- src/Tutorial.tsx | 2 +- src/index.css | 4 ++++ 5 files changed, 87 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/App.module.css b/src/App.module.css index a051663..06f0da6 100644 --- a/src/App.module.css +++ b/src/App.module.css @@ -19,6 +19,11 @@ margin-bottom: -10px; } +.iconRow h1 { + font-size: var(--font-xxl); + margin: 0; +} + .iconRow img { width: auto; height: 40px; @@ -40,3 +45,17 @@ } .tutorial {} + +.author .githubLink, +.author p { + display: flex; + flex-flow: row nowrap; + align-items: center; + margin: 5px 0; +} + +.author svg { + height: 20px; + width: 20px; + margin-right: 10px; +} \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index 9e78af3..5d33a38 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,13 +3,19 @@ import Editor from "./Editor" import Tutorial from "./Tutorial" import icon from "./favicon.png" +const GithubIcon = () => ( + +) + const App = () => { return (
- SLAM +

SLAM

A Mere Stack Language @@ -17,6 +23,17 @@ const App = () => {
+
+

Author

+

+ Jan Tuomi <jans.tuomi@gmail.com> +

+ + + +
Github
+
+
) } diff --git a/src/Editor.tsx b/src/Editor.tsx index 5548586..1d4b45a 100644 --- a/src/Editor.tsx +++ b/src/Editor.tsx @@ -1,7 +1,7 @@ import AceEditor from "react-ace" import "ace-builds/src-noconflict/mode-java" import "ace-builds/src-noconflict/theme-github" -import { useState } from "react" +import { useEffect, useState } from "react" import styles from "./Editor.module.css" import { SubmitResult, submitSource, useExamples } from "./api" import Select from "react-select" @@ -18,7 +18,11 @@ const Editor = () => { const examples = useExamples() const [sourceText, setSourceText] = useState(defaultSourceText) const [result, setResult] = useState({ type: "not_yet_requested" }) - const onChange = setSourceText + const [sourceDirty, setSourceDirty] = useState(false) + const onChange = (text: string) => { + setSourceText(text) + setSourceDirty(true) + } const executeCode = async (text: string) => { const result = await submitSource(text) @@ -29,7 +33,7 @@ const Editor = () => { switch (examples.type) { case "not_yet_requested": case "loading": - return
Loading examples...
+ return
Loading examples...
case "failed": return
An unexpected error occurred while loading examples. See console for details. @@ -51,9 +55,19 @@ const Editor = () => { } return (