From 28c43d662c1d511ec059d7ab38e66b33b82bdbe3 Mon Sep 17 00:00:00 2001 From: IlyaDoronin Date: Tue, 12 Dec 2023 16:13:27 +0300 Subject: [PATCH] fix: Number --- .../ViewPublicationPage/questions/Number.tsx | 64 +++++++++---------- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/src/pages/ViewPublicationPage/questions/Number.tsx b/src/pages/ViewPublicationPage/questions/Number.tsx index 6181161f..156bae2e 100644 --- a/src/pages/ViewPublicationPage/questions/Number.tsx +++ b/src/pages/ViewPublicationPage/questions/Number.tsx @@ -37,16 +37,14 @@ export const Number = ({ currentQuestion }: NumberProps) => { }, 1000 ); - const { answer } = - answers.find( - ({ questionId }) => questionId === currentQuestion.content.id - ) ?? {}; + const answer = answers.find( + ({ questionId }) => questionId === currentQuestion.content.id + )?.answer as string; const min = window.Number(currentQuestion.content.range.split("—")[0]); const max = window.Number(currentQuestion.content.range.split("—")[1]); useEffect(() => { - console.log("ans", currentQuestion.content.start); if (answer) { setMinRange(answer.split("—")[0]); setMaxRange(answer.split("—")[1]); @@ -76,8 +74,7 @@ export const Number = ({ currentQuestion }: NumberProps) => { marginTop: "20px", }} > - - 1 @@ -89,34 +86,35 @@ export const Number = ({ currentQuestion }: NumberProps) => { max={max} step={currentQuestion.content.step || 1} sx={{ + marginBottom: "20px", color: theme.palette.brightPurple.main, padding: "0", marginTop: "75px", - "& .MuiSlider-valueLabel":{ - background: theme.palette.brightPurple.main, - borderRadius: "8px", - width: "60px", - height: "36px" + "& .MuiSlider-valueLabel": { + background: theme.palette.brightPurple.main, + borderRadius: "8px", + width: "60px", + height: "36px", }, "& .MuiSlider-valueLabel::before": { - width: "6px", - height: "2px", - transform: "translate(-50%, 50%) rotate(90deg)", - bottom: "-5px" + width: "6px", + height: "2px", + transform: "translate(-50%, 50%) rotate(90deg)", + bottom: "-5px", + }, + "& .MuiSlider-rail": { + backgroundColor: "#F2F3F7", + border: `1px solid #9A9AAF`, + height: "12px", + }, + "& .MuiSlider-thumb": { + border: "3px #f2f3f7 solid", + height: "23px", + width: "23px", + }, + "& .MuiSlider-track": { + height: "12px", }, - "& .MuiSlider-rail": { - backgroundColor: "#F2F3F7", - border: `1px solid #9A9AAF`, - height: "12px" - }, - "& .MuiSlider-thumb": { - border: "3px #f2f3f7 solid", - height: "23px", - width: "23px" - }, - "& .MuiSlider-track": { - height: "12px" - } }} onChange={(_, value) => { const range = String(value).replace(",", "—"); @@ -152,12 +150,13 @@ export const Number = ({ currentQuestion }: NumberProps) => { }} /> )} - + {currentQuestion.content.chooseRange && ( @@ -180,9 +179,7 @@ export const Number = ({ currentQuestion }: NumberProps) => { "& .MuiInputBase-input": { textAlign: "center" }, }} /> - - до - + до { /> )} - );