Skip to content

Commit

Permalink
Disable editor when running code
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuth committed Jan 10, 2024
1 parent 1350c67 commit 8a6db76
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ type Props = {
};

export default function Editor({dispatch, state}: Props) {
const disabled = state.onLine != null;

return (
<div className="flex flex-col gap-2">
<label htmlFor="editor">
Expand All @@ -19,7 +21,11 @@ export default function Editor({dispatch, state}: Props) {
</div>
</div>
<textarea
className="w-56 border border-b-slate-950"
className={clsx(
'w-56 border border-b-slate-950',
disabled && 'cursor-not-allowed bg-slate-200',
)}
disabled={disabled ? true : undefined}
id="editor"
onChange={(e) =>
dispatch({type: 'CODE_TYPED', value: e.target.value})
Expand Down

0 comments on commit 8a6db76

Please sign in to comment.