Skip to content

Commit b71f303

Browse files
committed
feat: operator text replace iconicon
1 parent 7f496c2 commit b71f303

File tree

4 files changed

+32
-14
lines changed

4 files changed

+32
-14
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"dependencies": {
1313
"@emotion/react": "^11.14.0",
1414
"@emotion/styled": "^11.14.0",
15+
"@heroicons/react": "^2.2.0",
1516
"@monaco-editor/react": "^4.6.0",
1617
"@mui/material": "^6.4.3",
1718
"lua-fmt": "^2.6.0",

pnpm-lock.yaml

Lines changed: 18 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/ResultWindow.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from "react";
2+
import { XMarkIcon } from "@heroicons/react/24/outline";
23

34
interface IResultWindowProps {
45
result: string;
@@ -18,9 +19,10 @@ const ResultWindow: React.FC<IResultWindowProps> = ({
1819
<pre className="whitespace-pre-wrap">{result}</pre>
1920
<button
2021
onClick={onClear}
21-
className="absolute top-2 right-2 bg-red-500 text-white font-bold py-1 px-3 rounded shadow hover:bg-red-600"
22+
className="absolute top-4 right-4 bg-zinc-400 text-gray-700 font-bold p-2 rounded-full shadow hover:bg-zinc-600"
23+
title="Clear Output"
2224
>
23-
Clear
25+
<XMarkIcon className="h-5 w-5" />
2426
</button>
2527
</div>
2628
);

src/pages/index.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Layout from "@/components/Layout";
33
import EditorComponent from "@/components/Editor";
44
import ResultWindow from "@/components/ResultWindow";
55
import { languageExamples, LanguageType } from "@/constants/languageExamples";
6-
import prettier from "prettier";
6+
import { DocumentTextIcon, PlayIcon } from "@heroicons/react/24/outline";
77

88
const languageOptions = [
99
{ value: "javascript", label: "JavaScript" },
@@ -48,7 +48,7 @@ const EditorPage: React.FC = () => {
4848

4949
try {
5050
// Handle other languages with Prettier in frontend
51-
// const prettier = await import("prettier/standalone");
51+
const prettier = await import("prettier/standalone");
5252
const plugins = [];
5353

5454
switch (language) {
@@ -85,7 +85,7 @@ const EditorPage: React.FC = () => {
8585
return;
8686
}
8787

88-
const formattedCode = await prettier.format(code, {
88+
const formattedCode = await prettier.default.format(code, {
8989
parser: language === "typescript" ? "typescript" : "babel",
9090
plugins,
9191
printWidth: 80,
@@ -172,15 +172,18 @@ const EditorPage: React.FC = () => {
172172

173173
<button
174174
onClick={handleRun}
175-
className="absolute top-2 right-4 bg-blue-500 text-white font-bold py-2 px-4 rounded shadow hover:bg-blue-600 z-10"
175+
className="absolute top-4 right-5 bg-blue-600 text-gray-900 font-bold py-2 px-3 rounded shadow hover:bg-blue-700 z-10 flex gap-2 items-center"
176+
title="Run Code"
176177
>
178+
<PlayIcon className="h-5 w-5" />
177179
Run
178180
</button>
179181
<button
180182
onClick={handleFormat}
181-
className="absolute top-2 right-20 bg-green-500 text-white font-bold py-2 px-2 rounded shadow hover:bg-green-600 z-10"
183+
className="absolute top-4 right-32 bg-zinc-400 text-gray-700 font-bold p-3 rounded-full shadow hover:bg-zinc-600 z-10"
184+
title="Format Code"
182185
>
183-
Format
186+
<DocumentTextIcon className="h-5 w-5" />
184187
</button>
185188
</div>
186189
<ResultWindow result={result} onClear={handleClear} width="w-1/2" />

0 commit comments

Comments
 (0)