Skip to content

Commit

Permalink
Merge pull request #4 from ff6347/fix/responsiveness
Browse files Browse the repository at this point in the history
fix: Responsive style for output
  • Loading branch information
ff6347 authored Nov 8, 2023
2 parents c42ab4a + 65247b4 commit 51c19b3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
File renamed without changes.
8 changes: 6 additions & 2 deletions src/components/Sandbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,13 @@ export default function Sandbox(props: SandboxProps) {
iframeParent.removeChild(iframe);
const blob = new Blob([source], { type: "text/html" });
const blobUrl = URL.createObjectURL(blob);

iframe.src = blobUrl;
iframeParent.appendChild(iframe);
}
}
}, [code]);
const handleEditorChange = (value, event) => {
debouncedSetCode(value);

// here is the current value
// debounce(() => setCode((prev) => value));
};
Expand All @@ -80,7 +78,9 @@ export default function Sandbox(props: SandboxProps) {

const handleEditorWillMount = (monaco) => {
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
...monaco.languages.typescript.javascriptDefaults.getDiagnosticsOptions(),
noSemanticValidation: true,
noSuggestionDiagnostics: false,
noSyntaxValidation: false,
});

Expand All @@ -104,6 +104,10 @@ export default function Sandbox(props: SandboxProps) {
index,
"@types/p5/index.d.ts",
);
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
...monaco.languages.typescript.javascriptDefaults.getCompilerOptions(),
checkJs: true, // need this
});
// console.log("beforeMount: the monaco instance:", monaco);
};

Expand Down
7 changes: 5 additions & 2 deletions src/components/sandox.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ h3 {
max-width: 100vw;
resize: horizontal;
overflow: hidden;
border-right: 2px solid hsl(0 0% 10%);
border-right: 1px solid hsl(0 0% 70%);
}

.output {
Expand Down Expand Up @@ -92,14 +92,17 @@ xmp {
width: 100vw;
}

.sandbox {
flex-direction: column;
}
.editor {
resize: none;
border-right: none;
}

.output {
height: 100%;
border-top: 2px solid hsl(0 0% 10%);
border-top: 1px solid hsl(0 0% 90%);
}

.source {
Expand Down
10 changes: 6 additions & 4 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ import Sandbox from "../components/Sandbox.tsx";
title="Draft"
description="draft"
initialCode={`
//@ts-check
function setup(){
const canvas = createCanvas(100,100);
canvas.parent("sketch");
background(0);
}
function draw(){}
function draw(){
circle((1/sqrt(random())*50) - width/2,
random(height),
random(4))
}
`}
client:only
/>
Expand Down

0 comments on commit 51c19b3

Please sign in to comment.