расширение блоков и перенос слов при длинных ответах

This commit is contained in:
Tamara 2024-01-07 22:32:15 +03:00
parent a63623d122
commit 78204a4b76
5 changed files with 28 additions and 9 deletions

@ -152,7 +152,7 @@ export const Emoji = ({ currentQuestion }: EmojiProps) => {
} }
label={ label={
<Box sx={{ display: "flex", gap: "10px" }}> <Box sx={{ display: "flex", gap: "10px" }}>
<Typography>{variant.answer}</Typography> <Typography sx={{wordBreak: "break-word"}}>{variant.answer}</Typography>
</Box> </Box>
} }
/> />

@ -1,9 +1,9 @@
import { import {
Box, Box,
Typography, Typography,
ButtonBase, ButtonBase,
useTheme, useTheme,
IconButton, IconButton, useMediaQuery,
} from "@mui/material"; } from "@mui/material";
import { useQuizViewStore, updateAnswer } from "@root/quizView/store"; import { useQuizViewStore, updateAnswer } from "@root/quizView/store";
import { UPLOAD_FILE_TYPES_MAP } from "../tools/File"; import { UPLOAD_FILE_TYPES_MAP } from "../tools/File";
@ -47,6 +47,7 @@ export const File = ({ currentQuestion }: FileProps) => {
({ questionId }) => questionId === currentQuestion.id ({ questionId }) => questionId === currentQuestion.id
)?.answer as string; )?.answer as string;
const theme = useTheme(); const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down(500));
const uploadFile = async ({ target }: ChangeEvent<HTMLInputElement>) => { const uploadFile = async ({ target }: ChangeEvent<HTMLInputElement>) => {
const file = target.files?.[0]; const file = target.files?.[0];
if (file) { if (file) {
@ -98,10 +99,18 @@ export const File = ({ currentQuestion }: FileProps) => {
color: "#FFFFFF", color: "#FFFFFF",
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
overflow: "hidden",
gap: "15px", gap: "15px",
}} }}
> >
<Typography>{answer?.split("|")[0]}</Typography> <Typography
sx={{
whiteSpace: "nowrap",
textOverflow: "ellipsis",
overflow: "hidden",
}}
>
{answer?.split("|")[0]}</Typography>
<IconButton <IconButton
sx={{ p: 0 }} sx={{ p: 0 }}
onClick={() => { onClick={() => {
@ -129,7 +138,7 @@ export const File = ({ currentQuestion }: FileProps) => {
} }
sx={{ sx={{
width: "100%", width: "100%",
height: "120px", height: isMobile ? undefined : "120px",
display: "flex", display: "flex",
gap: "50px", gap: "50px",
justifyContent: "flex-start", justifyContent: "flex-start",

@ -127,10 +127,14 @@ export const Images = ({ currentQuestion }: ImagesProps) => {
<FormControlLabel <FormControlLabel
key={variant.id} key={variant.id}
sx={{ sx={{
display: "block",
textAlign: "center", textAlign: "center",
color: theme.palette.text.primary, color: theme.palette.text.primary,
marginTop: "10px", marginTop: "10px",
marginLeft: 0,
padding: "10px",
"& .MuiFormControlLabel-label": {
wordBreak: "break-word",
},
}} }}
value={index} value={index}
control={ control={

@ -158,6 +158,9 @@ const VariantItem = ({
"&.MuiFormControl-root": { "&.MuiFormControl-root": {
width: "100%", width: "100%",
}, },
"& .MuiFormControlLabel-label": {
wordBreak: "break-word"
}
}} }}
value={index} value={index}
labelPlacement="start" labelPlacement="start"

@ -75,6 +75,9 @@ export const Varimg = ({ currentQuestion }: VarimgProps) => {
borderColor: answer === variant.id ? theme.palette.primary.main : "#9A9AAF", borderColor: answer === variant.id ? theme.palette.primary.main : "#9A9AAF",
display: "flex", display: "flex",
margin: isMobile ? 0 : undefined, margin: isMobile ? 0 : undefined,
"& .MuiFormControlLabel-label": {
wordBreak: "break-word"
}
}} }}
value={index} value={index}
onClick={async(event) => { onClick={async(event) => {