Merge pull request 'Update BottomToolBar.tsx' (#7) from that into main
Reviewed-on: #7
This commit is contained in:
commit
603b4eb690
|
|
@ -11,7 +11,7 @@ import {
|
||||||
Tabs,
|
Tabs,
|
||||||
Text,
|
Text,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { useMemo, useState } from "react";
|
import { useEffect, useMemo, useRef, useState } from "react";
|
||||||
import classes from "./Component.module.css";
|
import classes from "./Component.module.css";
|
||||||
import type { IScenario, TLine, TStation } from "../untils/types";
|
import type { IScenario, TLine, TStation } from "../untils/types";
|
||||||
import type { Socket } from "socket.io-client";
|
import type { Socket } from "socket.io-client";
|
||||||
|
|
@ -64,9 +64,16 @@ const BottomToolBar = ({
|
||||||
: null;
|
: null;
|
||||||
}, []);
|
}, []);
|
||||||
const [valueInput, setValueInput] = useState<string>("");
|
const [valueInput, setValueInput] = useState<string>("");
|
||||||
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
// const [activeTabBottom, setActiveTabBottom] = useState<string>("command");
|
// const [activeTabBottom, setActiveTabBottom] = useState<string>("command");
|
||||||
// const [isExpand, setIsExpand] = useState<boolean>(true);
|
// const [isExpand, setIsExpand] = useState<boolean>(true);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (selectedLines?.length > 1 && inputRef?.current) {
|
||||||
|
inputRef?.current?.focus();
|
||||||
|
}
|
||||||
|
}, [selectedLines?.length]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
initial={false}
|
initial={false}
|
||||||
|
|
@ -224,6 +231,7 @@ const BottomToolBar = ({
|
||||||
</Flex>
|
</Flex>
|
||||||
<Box>
|
<Box>
|
||||||
<Input
|
<Input
|
||||||
|
ref={inputRef}
|
||||||
style={{
|
style={{
|
||||||
width: "30vw",
|
width: "30vw",
|
||||||
boxShadow: "0px 0px 10px rgba(0, 0, 0, 0.1)",
|
boxShadow: "0px 0px 10px rgba(0, 0, 0, 0.1)",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue