пофиксив варианты отображение дизайна главной страницы
This commit is contained in:
parent
e8483ef25e
commit
4b6995c11e
@ -142,6 +142,9 @@ export const StartPageViewPublication = ({ setVisualStartPage }: Props) => {
|
|||||||
fontStyle: "normal",
|
fontStyle: "normal",
|
||||||
fontStretch: "normal",
|
fontStretch: "normal",
|
||||||
lineHeight: "1.2",
|
lineHeight: "1.2",
|
||||||
|
overflowWrap: "break-word",
|
||||||
|
width: "100%",
|
||||||
|
textAlign: quiz.config.startpageType === "centered" ? "center" : "-moz-initial",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{quiz.name}
|
{quiz.name}
|
||||||
@ -150,6 +153,9 @@ export const StartPageViewPublication = ({ setVisualStartPage }: Props) => {
|
|||||||
sx={{
|
sx={{
|
||||||
fontSize: "16px",
|
fontSize: "16px",
|
||||||
m: "16px 0",
|
m: "16px 0",
|
||||||
|
overflowWrap: "break-word",
|
||||||
|
width: "100%",
|
||||||
|
textAlign: quiz.config.startpageType === "centered" ? "center" : "-moz-initial",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{quiz.config.startpage.description}
|
{quiz.config.startpage.description}
|
||||||
@ -172,7 +178,7 @@ export const StartPageViewPublication = ({ setVisualStartPage }: Props) => {
|
|||||||
<Box
|
<Box
|
||||||
sx={{ mt: "46px", display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" }}
|
sx={{ mt: "46px", display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" }}
|
||||||
>
|
>
|
||||||
<Box>
|
<Box sx={{ maxWidth: "300px" }}>
|
||||||
{quiz.config.info.clickable ? (
|
{quiz.config.info.clickable ? (
|
||||||
isMobileDevice ? (
|
isMobileDevice ? (
|
||||||
<Link href={`tel:${quiz.config.info.phonenumber}`}>
|
<Link href={`tel:${quiz.config.info.phonenumber}`}>
|
||||||
@ -192,7 +198,9 @@ export const StartPageViewPublication = ({ setVisualStartPage }: Props) => {
|
|||||||
{quiz.config.info.phonenumber}
|
{quiz.config.info.phonenumber}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
<Typography sx={{ fontSize: "12px", textAlign: "end" }}>{quiz.config.info.law}</Typography>
|
<Typography sx={{ width: "100%", overflowWrap: "break-word", fontSize: "12px", textAlign: "end" }}>
|
||||||
|
{quiz.config.info.law}
|
||||||
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
@ -329,7 +337,16 @@ function QuizPreviewLayoutByType({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{quizHeaderBlock}
|
{quizHeaderBlock}
|
||||||
{backgroundBlock && <Box>{backgroundBlock}</Box>}
|
{backgroundBlock && (
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
width: "60%",
|
||||||
|
overflow: "hidden",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{backgroundBlock}
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
{quizMainBlock}
|
{quizMainBlock}
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
import { FormControl, TextField, useTheme, SxProps, Theme } from "@mui/material";
|
import React, { useState } from "react";
|
||||||
|
import { Box, FormControl, TextField, Typography, useTheme } from "@mui/material";
|
||||||
import type { ChangeEvent, KeyboardEvent, FocusEvent } from "react";
|
import type { ChangeEvent, KeyboardEvent, FocusEvent } from "react";
|
||||||
import type { InputProps } from "@mui/material";
|
import type { InputProps, SxProps, Theme } from "@mui/material";
|
||||||
|
|
||||||
interface CustomTextFieldProps {
|
interface CustomTextFieldProps {
|
||||||
placeholder: string;
|
placeholder: string;
|
||||||
@ -11,6 +11,7 @@ interface CustomTextFieldProps {
|
|||||||
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
||||||
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
||||||
text?: string;
|
text?: string;
|
||||||
|
maxLength?: number;
|
||||||
sx?: SxProps<Theme>;
|
sx?: SxProps<Theme>;
|
||||||
InputProps?: Partial<InputProps>;
|
InputProps?: Partial<InputProps>;
|
||||||
}
|
}
|
||||||
@ -18,28 +19,54 @@ interface CustomTextFieldProps {
|
|||||||
export default function CustomTextField({
|
export default function CustomTextField({
|
||||||
placeholder,
|
placeholder,
|
||||||
value,
|
value,
|
||||||
text,
|
|
||||||
sx,
|
|
||||||
error,
|
|
||||||
onChange,
|
onChange,
|
||||||
onKeyDown,
|
onKeyDown,
|
||||||
onBlur,
|
onBlur,
|
||||||
|
text,
|
||||||
|
sx,
|
||||||
|
error,
|
||||||
InputProps,
|
InputProps,
|
||||||
|
maxLength = 200,
|
||||||
}: CustomTextFieldProps) {
|
}: CustomTextFieldProps) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
|
const [inputValue, setInputValue] = useState(value || "");
|
||||||
|
const [isInputActive, setIsInputActive] = useState(false);
|
||||||
|
|
||||||
|
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
const inputValue = event.target.value;
|
||||||
|
setInputValue(inputValue);
|
||||||
|
|
||||||
|
if (onChange) {
|
||||||
|
onChange(event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleInputFocus = () => {
|
||||||
|
setIsInputActive(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>) => {
|
||||||
|
setIsInputActive(false);
|
||||||
|
|
||||||
|
if (onBlur) {
|
||||||
|
onBlur(event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormControl fullWidth variant="standard" sx={{ p: 0 }}>
|
<FormControl fullWidth variant="standard" sx={{ p: 0 }}>
|
||||||
<TextField
|
<TextField
|
||||||
defaultValue={text}
|
defaultValue={text}
|
||||||
fullWidth
|
fullWidth
|
||||||
value={value}
|
value={inputValue}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
|
onChange={handleInputChange}
|
||||||
error={!!error}
|
error={!!error}
|
||||||
label={error}
|
label={error}
|
||||||
onChange={onChange}
|
onFocus={handleInputFocus}
|
||||||
|
onBlur={handleInputBlur}
|
||||||
onKeyDown={onKeyDown}
|
onKeyDown={onKeyDown}
|
||||||
onBlur={onBlur}
|
|
||||||
sx={{
|
sx={{
|
||||||
"& .MuiInputBase-root": {
|
"& .MuiInputBase-root": {
|
||||||
backgroundColor: theme.palette.background.default,
|
backgroundColor: theme.palette.background.default,
|
||||||
@ -50,19 +77,36 @@ export default function CustomTextField({
|
|||||||
fontSize: "13.5px",
|
fontSize: "13.5px",
|
||||||
marginTop: "3px",
|
marginTop: "3px",
|
||||||
},
|
},
|
||||||
...sx,
|
|
||||||
}}
|
}}
|
||||||
InputProps={InputProps}
|
InputProps={InputProps}
|
||||||
inputProps={{
|
inputProps={{
|
||||||
|
maxLength: maxLength,
|
||||||
sx: {
|
sx: {
|
||||||
borderRadius: "10px",
|
borderRadius: "10px",
|
||||||
fontSize: "18px",
|
fontSize: "18px",
|
||||||
lineHeight: "21px",
|
lineHeight: "21px",
|
||||||
py: 0,
|
py: 0,
|
||||||
},
|
},
|
||||||
|
...sx,
|
||||||
}}
|
}}
|
||||||
data-cy="textfield"
|
data-cy="textfield"
|
||||||
/>
|
/>
|
||||||
|
{isInputActive && inputValue.length >= maxLength - 7 && (
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
marginTop: "5px",
|
||||||
|
marginLeft: "auto",
|
||||||
|
position: "absolute",
|
||||||
|
bottom: "-25px",
|
||||||
|
right: "0",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography fontSize="14px">{inputValue.length}</Typography>
|
||||||
|
<span>/</span>
|
||||||
|
<Typography fontSize="14px">{maxLength}</Typography>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
</FormControl>
|
</FormControl>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user