From 2e869560c8b0eccbf15e62e7908bb68eee359d80 Mon Sep 17 00:00:00 2001 From: Tamara Date: Fri, 16 Feb 2024 00:49:21 +0300 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=20=D0=B8=D0=BD=D0=BF?= =?UTF-8?q?=D1=83=D1=82=D0=BE=D0=B2=20=D0=B2=20=D1=80=D0=B5=D0=B7=D1=83?= =?UTF-8?q?=D0=BB=D1=8C=D1=82=D0=B0=D1=82=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/ResultPage/cards/ResultCard.tsx | 43 ++++++++--------------- src/ui_kit/Sidebar/SidebarMobile.tsx | 13 ++++--- 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/src/pages/ResultPage/cards/ResultCard.tsx b/src/pages/ResultPage/cards/ResultCard.tsx index b897639c..f9b4d45f 100644 --- a/src/pages/ResultPage/cards/ResultCard.tsx +++ b/src/pages/ResultPage/cards/ResultCard.tsx @@ -131,7 +131,7 @@ export const ResultCard = ({ resultContract, resultData }: Props) => { const [expand, setExpand] = useState(true); const [resultCardSettings, setResultCardSettings] = useState(false); const [buttonPlus, setButtonPlus] = useState(true); - const [inputValue, setInputValue] = useState(""); + const [inputValue, setInputValue] = useState(resultData.content.text); const question = getQuestionByContentId(resultData.content.rule.parentId); const quiz = useCurrentQuiz(); @@ -188,7 +188,7 @@ export const ResultCard = ({ resultContract, resultData }: Props) => { marginRight: isMobile ? "0px" : "16.1px", }} > - @@ -199,28 +199,16 @@ export const ResultCard = ({ resultContract, resultData }: Props) => { } sx={{ margin: isMobile ? "10px 0" : 0, - "& .MuiInputBase-root": { - color: "#000000", - backgroundColor: expand - ? theme.palette.background.default - : "transparent", - height: "48px", - borderRadius: "10px", - ".MuiOutlinedInput-notchedOutline": { - borderWidth: "1px !important", - border: !expand ? "none" : null, - }, - "& .MuiInputBase-input::placeholder": { - color: "#4D4D4D", - opacity: 0.8, - }, - }, - }} - inputProps={{ - sx: { - p: 0, - fontSize: "18px", - lineHeight: "21px", + backgroundColor: expand + ? theme.palette.background.default + : "transparent", + height: "48px", + borderRadius: "10px", + borderWidth: "1px !important", + border: !expand ? "none" : null, + "&::placeholder": { + color: "#4D4D4D", + opacity: 0.8, }, }} /> @@ -328,15 +316,14 @@ export const ResultCard = ({ resultContract, resultData }: Props) => { { if (target.value.length <= 3000) { - const inputValue = target.value; - setInputValue(inputValue); + setInputValue(target.value); } updateQuestion( resultData.id, - (question) => (question.content.text = inputValue), + (question) => (question.content.text = target.value), ); }} fullWidth diff --git a/src/ui_kit/Sidebar/SidebarMobile.tsx b/src/ui_kit/Sidebar/SidebarMobile.tsx index 298c9965..4f8075d6 100644 --- a/src/ui_kit/Sidebar/SidebarMobile.tsx +++ b/src/ui_kit/Sidebar/SidebarMobile.tsx @@ -28,6 +28,7 @@ import { logout } from "@api/auth"; import { enqueueSnackbar } from "notistack"; import { clearAuthToken } from "@frontend/kitui"; import { clearUserData } from "@root/user"; +import CustomTextField from "@ui_kit/CustomTextField"; interface Iprops { open: boolean; @@ -55,6 +56,7 @@ export const SidebarMobile: FC = ({ const [anchorEl, setAnchorEl] = useState(null); const [inputOpen, setInputOpen] = useState(false); const quiz = useCurrentQuiz(); + const [inputValue, setInputValue] = useState(quiz.name); const ref = useRef(null); const heightSidebar = useRef(null); const navigate = useNavigate(); @@ -134,12 +136,15 @@ export const SidebarMobile: FC = ({ + value={inputValue} + onChange={(e) => { + if (e.target.value.length <= 200) { + setInputValue(e.target.value); + } updateQuiz(quiz.id, (quiz) => { quiz.name = e.target.value; - }) - } + }); + }} fullWidth id="project-name" placeholder="Название проекта"