diff --git a/src/editor/Property/FineInput.tsx b/src/editor/Property/FineInput.tsx new file mode 100644 index 0000000..3298d5a --- /dev/null +++ b/src/editor/Property/FineInput.tsx @@ -0,0 +1,19 @@ +import { Input } from "antd"; +import { useState } from "react"; + +export type FineInputProps = { + value: string | number; + onChange: (value: string) => void; +}; + +export const FineInput = (props: FineInputProps) => { + const [value, setValue] = useState(props.value); + + return ( + setValue(e.target.value)} + onBlur={(e) => props.onChange(e.target.value)} + /> + ); +}; diff --git a/src/editor/Property/index.tsx b/src/editor/Property/index.tsx index dfb96ce..7540a4f 100644 --- a/src/editor/Property/index.tsx +++ b/src/editor/Property/index.tsx @@ -3,9 +3,12 @@ import { Form, Input, Select } from "antd"; import { selectedIdsSelector, mapOptionsSelector, StoreAction } from "@store"; import { OverlayCategory, IOverlay } from "@map"; -import "./index.less"; import { OverlayTypes } from "@types"; +import { FineInput } from "./FineInput"; + +import "./index.less"; + type CategoryItem = { title: string; value: OverlayCategory; @@ -40,12 +43,12 @@ const Property = () => {
- + onChange={(value) => updateOverlayProps({ id: overlay.id, - name: e.target.value, + name: value, }) } /> @@ -67,6 +70,19 @@ const Property = () => { ))} + {overlay.category === OverlayCategory.Building ? ( + + + updateOverlayProps({ + id: overlay.id, + height: +value, + }) + } + /> + + ) : null}
);