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

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 fireOnce = useRef(true)
const [fire, setFire] = useState(false) const [fire, setFire] = useState(false)
const isMobile = useMediaQuery(theme.breakpoints.down(600)); const isMobile = useMediaQuery(theme.breakpoints.down(850));
const followNextForm = () => { const followNextForm = () => {
setShowContactForm(false); 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="не получилось найти результат для этой ветки :(" /> if (!resultQuestion) return <ApologyPage message="не получилось найти результат для этой ветки :(" />
@ -120,19 +133,28 @@ export const ContactForm = ({
alignItems: "center", alignItems: "center",
justifyContent: "center", justifyContent: "center",
backgroundColor: theme.palette.background.default, backgroundColor: theme.palette.background.default,
height: "100vh" height: "100vh",
overflow: "auto",
}} }}
> >
<Box <Box
sx={{ sx={{
width: isMobile ? "330px" : "530px", width: isWide && !isMobile ? "100%" : (isMobile ? undefined : "530px"),
borderRadius: "4px", borderRadius: "4px",
overflow: "auto",
height: "90vh", 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 <Typography
sx={{ sx={{
textAlign: "center", textAlign: "center",

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