Add a setting to resize table width (#21)

This commit is contained in:
1ilit
2024-04-10 06:47:06 +03:00
parent 6ab13a70d2
commit 895c1da2b0
9 changed files with 65 additions and 38 deletions

View File

@@ -27,6 +27,7 @@ import New from "./New";
import ImportDiagram from "./ImportDiagram";
import ImportSource from "./ImportSource";
import Editor from "@monaco-editor/react";
import SetTableWidth from "./SetTableWidth";
export default function Modal({
modal,
@@ -105,7 +106,7 @@ export default function Modal({
ast = parser.astify(importSource.src, { database: "MySQL" });
} catch (err) {
Toast.error(
"Could not parse the sql file. Make sure there are no syntax errors."
"Could not parse the sql file. Make sure there are no syntax errors.",
);
return;
}
@@ -135,7 +136,7 @@ export default function Modal({
case MODAL.IMG:
saveAs(
exportData.data,
`${exportData.filename}.${exportData.extension}`
`${exportData.filename}.${exportData.extension}`,
);
return;
case MODAL.CODE: {
@@ -259,6 +260,8 @@ export default function Modal({
</div>
);
}
case MODAL.TABLE_WIDTH:
return <SetTableWidth />;
default:
return <></>;
}

View File

@@ -0,0 +1,17 @@
import { InputNumber } from "@douyinfe/semi-ui";
import { useSettings } from "../../../hooks";
export default function SetTableWidth() {
const { settings, setSettings } = useSettings();
return (
<InputNumber
className="w-full"
value={settings.tableWidth}
onChange={(c) => {
if (c < 180) return;
setSettings((prev) => ({ ...prev, tableWidth: c }));
}}
/>
);
}