форма контактов меняет положение блоков при увеличении количества полей

This commit is contained in:
Tamara 2024-01-07 02:56:13 +03:00
parent 92d77f9806
commit a63623d122
2 changed files with 29 additions and 6 deletions

@ -56,7 +56,7 @@ export const ContactForm = ({
const fireOnce = useRef(true)
const [fire, setFire] = useState(false)
const isMobile = useMediaQuery(theme.breakpoints.down(600));
const isMobile = useMediaQuery(theme.breakpoints.down(850));
const followNextForm = () => {
setShowContactForm(false);
@ -110,6 +110,19 @@ export const ContactForm = ({
}
}
//@ts-ignore
let FCcopy: any = settings?.cfg.formContact.fields || settings?.cfg.formContact;
let filteredFC: any = {}
for (let i in FCcopy) {
let field = FCcopy[i]
console.log(filteredFC)
if (field.used) {
filteredFC[i] = field
}
}
let isWide = Object.keys(filteredFC).length > 2
console.log(isWide)
if (!resultQuestion) return <ApologyPage message="не получилось найти результат для этой ветки :(" />
@ -120,19 +133,28 @@ export const ContactForm = ({
alignItems: "center",
justifyContent: "center",
backgroundColor: theme.palette.background.default,
height: "100vh"
height: "100vh",
overflow: "auto",
}}
>
<Box
sx={{
width: isMobile ? "330px" : "530px",
width: isWide && !isMobile ? "100%" : (isMobile ? undefined : "530px"),
borderRadius: "4px",
overflow: "auto",
height: "90vh",
display: isWide && !isMobile ? "flex" : undefined
}}
>
<Box>
<Box
sx={{
width: isWide && !isMobile ? "100%" : undefined,
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
borderRight: isWide && !isMobile ? "1px solid gray" : undefined
}}
>
<Typography
sx={{
textAlign: "center",

@ -70,6 +70,7 @@ export const ResultForm = ({
height: isMobile ? undefined : "100vh",
width: "100vw",
pt: "28px",
overflow: "auto"
}}
>
<Box