feat: Select article list in sight
This commit is contained in:
32
src/shared/ui/CoordinatesInput/index.tsx
Normal file
32
src/shared/ui/CoordinatesInput/index.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Box, TextField } from "@mui/material";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export const CoordinatesInput = ({
|
||||
setValue,
|
||||
}: {
|
||||
setValue: (value: { latitude: number; longitude: number }) => void;
|
||||
}) => {
|
||||
const [inputValue, setInputValue] = useState<string>("");
|
||||
|
||||
useEffect(() => {
|
||||
setValue({
|
||||
latitude: Number(inputValue.split(" ")[0]),
|
||||
longitude: Number(inputValue.split(" ")[1]),
|
||||
});
|
||||
}, [inputValue]);
|
||||
|
||||
return (
|
||||
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
|
||||
<TextField
|
||||
label="Координаты"
|
||||
value={inputValue}
|
||||
onChange={(e) => {
|
||||
setInputValue(e.target.value);
|
||||
}}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
helperText="Формат: широта, долгота (например, 59.9398, 30.3146)"
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from "./TabPanel";
|
||||
export * from "./BackButton";
|
||||
export * from "./Modal";
|
||||
export * from "./CoordinatesInput";
|
||||
|
||||
Reference in New Issue
Block a user