Merge branch 'fixes' into dev

This commit is contained in:
Nastya 2024-01-07 22:27:53 +03:00
commit 720afdd045
15 changed files with 35 additions and 5 deletions

@ -12,6 +12,7 @@ type CustomSliderProps = {
_: React.SyntheticEvent | Event, _: React.SyntheticEvent | Event,
value: number | number[], value: number | number[],
) => void; ) => void;
className: string;
}; };
export const CustomSlider = ({ export const CustomSlider = ({
@ -23,6 +24,7 @@ export const CustomSlider = ({
onChange, onChange,
onChangeCommitted, onChangeCommitted,
sx, sx,
className
}: CustomSliderProps) => { }: CustomSliderProps) => {
// const handleChange = ({ type }: Event, newValue: number | number[]) => { // const handleChange = ({ type }: Event, newValue: number | number[]) => {
// // Для корректной работы слайдера в FireFox // // Для корректной работы слайдера в FireFox
@ -34,6 +36,7 @@ export const CustomSlider = ({
return ( return (
<Slider <Slider
className={className || ""}
value={value} value={value}
defaultValue={defaultValue} defaultValue={defaultValue}
min={min} min={min}

@ -26,6 +26,7 @@ interface CustomTextFieldProps {
InputProps?: Partial<InputProps>; InputProps?: Partial<InputProps>;
type?: string; type?: string;
rows?: number; rows?: number;
className?:string;
} }
export default function CustomTextField({ export default function CustomTextField({
@ -43,6 +44,8 @@ export default function CustomTextField({
type = "", type = "",
rows = 0, rows = 0,
sxForm, sxForm,
className
}: CustomTextFieldProps) { }: CustomTextFieldProps) {
const theme = useTheme(); const theme = useTheme();
@ -80,7 +83,7 @@ export default function CustomTextField({
}; };
return ( return (
<FormControl fullWidth variant="standard" sx={{ p: 0, ...sxForm }}> <FormControl fullWidth variant="standard" sx={{ p: 0, ...sxForm }} className={className || ""}>
{error && ( {error && (
<InputLabel <InputLabel
sx={{ sx={{

@ -17,6 +17,7 @@ interface Props {
sxDate?: SxProps<Theme>; sxDate?: SxProps<Theme>;
value?: Dayjs | null; value?: Dayjs | null;
onChange?: (value: Dayjs | null) => void; onChange?: (value: Dayjs | null) => void;
className?: string
} }
export default function LabeledDatePicker({ export default function LabeledDatePicker({
@ -26,6 +27,7 @@ export default function LabeledDatePicker({
sx, sx,
sxIcon, sxIcon,
sxDate, sxDate,
className
}: Props) { }: Props) {
const theme = useTheme(); const theme = useTheme();
const upLg = useMediaQuery(theme.breakpoints.up("md")); const upLg = useMediaQuery(theme.breakpoints.up("md"));
@ -50,6 +52,7 @@ export default function LabeledDatePicker({
</Typography> </Typography>
)} )}
<DatePicker <DatePicker
className={className || ""}
value={value} value={value}
onChange={onChange} onChange={onChange}
slots={{ slots={{

@ -117,6 +117,7 @@ export default function QuizPreview() {
overflow: "hidden", overflow: "hidden",
pointerEvents: "auto", pointerEvents: "auto",
}} }}
cancel=".cancel"
> >
<QuizPreviewLayout /> <QuizPreviewLayout />
</Rnd> </Rnd>

@ -117,6 +117,7 @@ export default function QuizPreviewLayout() {
fullWidth fullWidth
size="small" size="small"
sx={{ width: "100%", minWidth: "200px", height: "48px" }} sx={{ width: "100%", minWidth: "200px", height: "48px" }}
className="cancel"
> >
<MuiSelect <MuiSelect
id="category-select" id="category-select"
@ -235,6 +236,7 @@ export default function QuizPreviewLayout() {
onClick={decrementCurrentQuestionIndex} onClick={decrementCurrentQuestionIndex}
disabled={currentQuizStep === 0} disabled={currentQuizStep === 0}
sx={{ px: 1, minWidth: 0 }} sx={{ px: 1, minWidth: 0 }}
className="cancel"
> >
<ArrowLeft color={theme.palette.primary.main} /> <ArrowLeft color={theme.palette.primary.main} />
</Button> </Button>
@ -242,6 +244,7 @@ export default function QuizPreviewLayout() {
variant="contained" variant="contained"
onClick={() => incrementCurrentQuestionIndex(maxCurrentQuizStep)} onClick={() => incrementCurrentQuestionIndex(maxCurrentQuizStep)}
disabled={currentQuizStep >= maxCurrentQuizStep} disabled={currentQuizStep >= maxCurrentQuizStep}
className="cancel"
> >
Далее Далее
</Button> </Button>

@ -39,6 +39,7 @@ export default function Date({ question }: Props) {
pr: "22px", pr: "22px",
}, },
}} }}
className="cancel"
/> />
</Box> </Box>
); );

@ -29,7 +29,8 @@ export default function Emoji({ question }: Props) {
}; };
return ( return (
<FormControl fullWidth> <FormControl fullWidth
className="cancel">
<FormLabel <FormLabel
id="quiz-question-radio-group" id="quiz-question-radio-group"
data-cy="question-title" data-cy="question-title"
@ -83,6 +84,7 @@ export default function Emoji({ question }: Props) {
</Box> </Box>
</Box> </Box>
<FormControlLabel <FormControlLabel
className="cancel"
key={index} key={index}
value={variant.answer} value={variant.answer}
sx={{ sx={{

@ -47,7 +47,8 @@ export default function File({ question }: Props) {
<Typography variant="h6" data-cy="question-title"> <Typography variant="h6" data-cy="question-title">
{question.title} {question.title}
</Typography> </Typography>
<Button variant="contained" onClick={() => fileInputRef.current?.click()}> <Button variant="contained" onClick={() => fileInputRef.current?.click()}
className="cancel">
Загрузить файл Загрузить файл
<input <input
ref={fileInputRef} ref={fileInputRef}
@ -58,6 +59,7 @@ export default function File({ question }: Props) {
style={{ style={{
display: "none", display: "none",
}} }}
className="cancel"
/> />
</Button> </Button>
{file && ( {file && (

@ -63,6 +63,7 @@ export default function Images({ question, widthPreview }: Props) {
.filter(({ answer }) => answer) .filter(({ answer }) => answer)
.map((variant, index) => ( .map((variant, index) => (
<ButtonBase <ButtonBase
className="cancel"
key={index} key={index}
onClick={() => handleVariantClick(index)} onClick={() => handleVariantClick(index)}
data-cy="variant-button" data-cy="variant-button"

@ -47,6 +47,7 @@ export default function Number({ question }: Props) {
}} }}
> >
<CustomSlider <CustomSlider
className="cancel"
value={sliderValues} value={sliderValues}
onChange={(e, value) => { onChange={(e, value) => {
setSliderValues(value); setSliderValues(value);
@ -92,6 +93,7 @@ export default function Number({ question }: Props) {
}} }}
> >
<CustomTextField <CustomTextField
className="cancel"
placeholder="0" placeholder="0"
value={sliderValues[0]} value={sliderValues[0]}
sx={{ sx={{
@ -107,6 +109,7 @@ export default function Number({ question }: Props) {
/> />
<Typography color={theme.palette.text.primary}>до</Typography> <Typography color={theme.palette.text.primary}>до</Typography>
<CustomTextField <CustomTextField
className="cancel"
placeholder="0" placeholder="0"
value={sliderValues[1]} value={sliderValues[1]}
sx={{ sx={{

@ -69,6 +69,7 @@ export default function Rating({ question }: Props) {
}} }}
> >
<Box <Box
className="cancel"
data-cy="rating" data-cy="rating"
data-rating={selectedRating} data-rating={selectedRating}
sx={{ sx={{

@ -36,6 +36,7 @@ export default function Text({ question }: Props) {
{question.title} {question.title}
</Typography> </Typography>
<FormControl <FormControl
className="cancel"
fullWidth fullWidth
size="small" size="small"
sx={{ sx={{

@ -20,7 +20,8 @@ export default function Text({ question }: Props) {
<Typography variant="h6" data-cy="question-title"> <Typography variant="h6" data-cy="question-title">
{question.title} {question.title}
</Typography> </Typography>
<CustomTextField placeholder={question.content.placeholder} /> <CustomTextField placeholder={question.content.placeholder}
className="cancel"/>
</Box> </Box>
); );
} }

@ -37,7 +37,8 @@ export default function Variant({ question }: Props) {
}; };
return ( return (
<FormControl fullWidth> <FormControl
className="cancel" fullWidth>
<FormLabel <FormLabel
id="quiz-question-radio-group" id="quiz-question-radio-group"
data-cy="question-title" data-cy="question-title"
@ -51,6 +52,7 @@ export default function Variant({ question }: Props) {
{question.title} {question.title}
</FormLabel> </FormLabel>
<RadioGroup <RadioGroup
className="cancel"
aria-labelledby="quiz-question-radio-group" aria-labelledby="quiz-question-radio-group"
value={value} value={value}
onChange={handleChange} onChange={handleChange}
@ -63,6 +65,7 @@ export default function Variant({ question }: Props) {
.filter(({ answer }) => answer) .filter(({ answer }) => answer)
.map((variant, index) => ( .map((variant, index) => (
<FormControlLabel <FormControlLabel
className="cancel"
key={index} key={index}
value={variant.answer} value={variant.answer}
data-cy="variant-answer" data-cy="variant-answer"

@ -52,6 +52,7 @@ export default function Varimg({ question, widthPreview }: Props) {
}} }}
> >
<FormControl <FormControl
className="cancel"
sx={{ sx={{
//maxWidth: "900px", //maxWidth: "900px",
width: "100%", width: "100%",
@ -78,6 +79,7 @@ export default function Varimg({ question, widthPreview }: Props) {
}} }}
> >
<RadioGroup <RadioGroup
className="cancel"
aria-labelledby="quiz-question-radio-group" aria-labelledby="quiz-question-radio-group"
value={currentVariant?.answer ?? ""} value={currentVariant?.answer ?? ""}
onChange={handleChange} onChange={handleChange}