diff --git a/src/pages/Questions/branchingQuestions.tsx b/src/pages/Questions/branchingQuestions.tsx index 578c7a00..139dd345 100644 --- a/src/pages/Questions/branchingQuestions.tsx +++ b/src/pages/Questions/branchingQuestions.tsx @@ -1,3 +1,4 @@ +import { useState, useRef, useEffect } from "react"; import { useParams } from "react-router-dom"; import { Box, @@ -40,9 +41,16 @@ const CONDITIONS = [ export default function BranchingQuestions({ totalIndex, }: BranchingQuestionsProps) { + const [title, setTitle] = useState("Заголовок работа"); + const [titleInputWidth, setTitleInputWidth] = useState(0); const quizId = Number(useParams().quizId); const { openedModalSettings, listQuestions } = questionStore(); const theme = useTheme(); + const titleRef = useRef(null); + + useEffect(() => { + setTitleInputWidth(titleRef.current?.offsetWidth || 0); + }, [title]); const handleClose = () => { resetSomeField({ openedModalSettings: "" }); @@ -80,7 +88,37 @@ export default function BranchingQuestions({ display: "flex", }} > - () + + ( + + + {title} + + setTitle(target.value)} + style={{ + width: titleInputWidth, + outline: "none", + background: "transparent", + border: "none", + fontSize: "18px", + minWidth: "150px", + maxWidth: "500px", + }} + /> + + ) +