фикс инпутов в результатах

This commit is contained in:
Tamara 2024-02-16 00:49:21 +03:00
parent b0faac78cf
commit 2e869560c8
2 changed files with 24 additions and 32 deletions

@ -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",
}}
>
<TextField
<CustomTextField
value={resultData.title}
placeholder={"Заголовок результата"}
onChange={({ target }: { target: HTMLInputElement }) =>
@ -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) => {
<TextField
id="heading-description"
value={resultData.content.text}
value={inputValue}
onChange={({ target }: { target: HTMLInputElement }) => {
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

@ -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<Iprops> = ({
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
const [inputOpen, setInputOpen] = useState<boolean>(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<Iprops> = ({
<FormControl fullWidth variant="standard">
<TextField
ref={ref}
value={quiz.name}
onChange={(e) =>
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="Название проекта"