lingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
30 lines • 2.17 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
import { signal, useSignal } from "@preact/signals";
import Dialog from "../component/Dialog";
import CloseableTab from "../component/tabs/CloseableTab";
import { APPBAR_HEIGHT } from "../../globals";
import TextBox from "../component/TextBox";
import SelectBox from "../component/SelectBox";
import IconButton from "../component/IconButton";
import { useRef } from "preact/hooks";
export const newScriptDialogSignal = signal(undefined);
const NewScriptDialog = () => {
const { value } = newScriptDialogSignal;
const nameSignal = useSignal("");
const langaugeRef = useRef("TypeScript");
if (!value)
return null;
return (_jsxs(Dialog, { signal: newScriptDialogSignal, children: [_jsx(CloseableTab, { width: "100%", height: APPBAR_HEIGHT, onClose: () => (newScriptDialogSignal.value = undefined), children: "New Script" }), _jsxs("div", { style: { flexGrow: 1 }, children: [_jsx(TextBox, { placeholder: "Script Name", style: { marginTop: 12 }, onChange: (val) => (nameSignal.value = val) }), _jsx(SelectBox, { label: "Language", style: { paddingLeft: 12, paddingRight: 6 }, options: ["TypeScript", "JavaScript"], onChange: (_, val) => (langaugeRef.current = val) }), _jsxs("div", { style: {
padding: 10,
marginTop: 10,
display: "flex",
gap: 4
}, children: [_jsx("div", { style: { flexGrow: 1 } }), _jsx(IconButton, { label: "Cancel", fill: "rgba(255, 255, 255, 0.05)", borderless: true, onClick: () => (newScriptDialogSignal.value = undefined) }), _jsx(IconButton, { label: "Confirm", fill: true, disabled: !nameSignal.value, onClick: () => {
if (!nameSignal.value)
return;
value.onConfirm(nameSignal.value, langaugeRef.current);
newScriptDialogSignal.value = undefined;
} })] })] })] }));
};
export default NewScriptDialog;
//# sourceMappingURL=NewScriptDialog.js.map