mirror of
https://github.com/trafficlunar/blockmatic.git
synced 2026-06-28 14:44:12 +00:00
feat: set version dialog
This commit is contained in:
parent
cf83d2fc7c
commit
a7e5dfd3d6
10 changed files with 908 additions and 27 deletions
40
src/components/dialogs/SetVersion.tsx
Normal file
40
src/components/dialogs/SetVersion.tsx
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import { useContext, useState } from "react";
|
||||
|
||||
import { CanvasContext } from "@/context/Canvas";
|
||||
|
||||
import { DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import VersionCombobox from "../VersionCombobox";
|
||||
|
||||
function SetVersion({ close }: DialogProps) {
|
||||
const { version: contextVersion, setVersion: setContextVersion } = useContext(CanvasContext);
|
||||
|
||||
const [version, setVersion] = useState(contextVersion);
|
||||
|
||||
const onSubmit = () => {
|
||||
setContextVersion(version);
|
||||
close();
|
||||
};
|
||||
|
||||
return (
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Set Version</DialogTitle>
|
||||
<DialogDescription>Updates your block palette to the specified Minecraft version</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<VersionCombobox version={version} setVersion={setVersion} />
|
||||
|
||||
<DialogFooter>
|
||||
<Button variant="outline" onClick={close}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button type="submit" onClick={onSubmit}>
|
||||
Set
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
);
|
||||
}
|
||||
|
||||
export default SetVersion;
|
||||
Loading…
Add table
Add a link
Reference in a new issue