Driwer для кнопок мессенджеры и поле ввода

This commit is contained in:
Tamara 2023-04-17 05:27:22 +03:00 committed by krokodilka
parent 5986c250f7
commit 07c4382dbf
12 changed files with 181 additions and 129 deletions

@ -1,10 +1,6 @@
import MiniButtonSetting from "@ui_kit/MiniButtonSetting"; import MiniButtonSetting from "@ui_kit/MiniButtonSetting";
import React from "react"; import React from "react";
import SettingIcon from "@icons/questionsPage/settingIcon"; import SettingIcon from "@icons/questionsPage/settingIcon";
import Clue from "@icons/questionsPage/clue";
import HideIcon from "@icons/questionsPage/hideIcon";
import CopyIcon from "@icons/questionsPage/CopyIcon";
import DeleteIcon from "@icons/questionsPage/deleteIcon";
import Branching from "@icons/questionsPage/branching"; import Branching from "@icons/questionsPage/branching";
import {Box, useTheme} from "@mui/material"; import {Box, useTheme} from "@mui/material";
import SupplementIcon from "@icons/ContactFormIcon/supplementIcon"; import SupplementIcon from "@icons/ContactFormIcon/supplementIcon";
@ -14,7 +10,7 @@ interface Props {
SSHC: (data:string) => void SSHC: (data:string) => void
} }
export default function ButtonsOptions ({SSHC, switchState}:Props) { export default function ButtonSettingForms ({SSHC, switchState}:Props) {
const theme = useTheme(); const theme = useTheme();
const buttonSetting: {icon: JSX.Element; title: string; value: string} [] =[ const buttonSetting: {icon: JSX.Element; title: string; value: string} [] =[
{icon: <SettingIcon color={switchState === 'setting' ? '#ffffff' : theme.palette.grey3.main}/>, title: 'Настройки', value: 'setting'}, {icon: <SettingIcon color={switchState === 'setting' ? '#ffffff' : theme.palette.grey3.main}/>, title: 'Настройки', value: 'setting'},

@ -1,13 +1,17 @@
import React from "react"; import React from "react";
import Stepper from '@ui_kit/Stepper'; import Stepper from '@ui_kit/Stepper';
import {Box, Button, IconButton, Typography, Paper, useTheme, Link} from '@mui/material'; import {Box, Button, IconButton, Typography, Paper, useTheme, Link, SxProps, Theme, TextField} from '@mui/material';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import CustomTextField from "@ui_kit/CustomTextField"; import CustomTextField from "@ui_kit/CustomTextField";
import OneIcon from "../../components/icons/questionsPage/OneIcon"; import OneIcon from "../../components/icons/questionsPage/OneIcon";
import PointsIcon from "../../components/icons/questionsPage/PointsIcon";
import AddPlus from "../../components/icons/questionsPage/addPlus"; import AddPlus from "../../components/icons/questionsPage/addPlus";
import ArrowLeft from "../../components/icons/questionsPage/arrowLeft"; import ArrowLeft from "../../components/icons/questionsPage/arrowLeft";
import InfoIcon from "@icons/InfoIcon"; import InfoIcon from "@icons/InfoIcon";
import ButtonSettingForms from "./ButtonSettingForms";
import SwitchContactForm from "./switchContactForm";
import DrawerNewField from "./DrawerParent";
import WindowNewField from "./NewField/WindowNewField";
import WindowMessengers from "./Massengers/WindowMessengers";
export default function ContactFormPage() { export default function ContactFormPage() {
@ -34,7 +38,92 @@ export default function ContactFormPage() {
textDecorationColor: theme.palette.brightPurple.main textDecorationColor: theme.palette.brightPurple.main
}}>Как собрать данные посетителя</Link> <InfoIcon/> }}>Как собрать данные посетителя</Link> <InfoIcon/>
</Box> </Box>
<Paper sx={{maxWidth: '796px', width: '100%', borderRadius: '12px', margin: '20px 0', display: 'flex',}}> <ContactFormParent>
<Box sx={{display: 'flex', alignItems: 'center', justifyContent: 'end'}}>
<OneIcon/>
<IconButton> <ExpandMoreIcon /> </IconButton>
</Box>
<Box sx={{display: 'flex', flexDirection: 'column', gap: '20px', padding: '10px 20px'}}>
<Typography>Имя*</Typography>
<CustomTextField placeholder="Дмитрий" text={""} />
<Typography>E-mail*</Typography>
<CustomTextField placeholder="+7 900 000 00 00" text={""} />
<Typography>Телефон*</Typography>
<CustomTextField placeholder="+7 900 000 00 00" text={""} />
<DrawerNewField><WindowNewField/></DrawerNewField>
<DrawerNewField>
{/* <Link sx={{*/}
{/* mt: "20px",*/}
{/* fontSize: "16px",*/}
{/* lineHeight: "19px",*/}
{/* color: theme.palette.brightPurple.main,*/}
{/* textDecorationColor: theme.palette.brightPurple.main*/}
{/*}}>Добавить мессенджеры</Link>*/}
<WindowMessengers/>
</DrawerNewField>
<Button variant='contained' sx={{padding: '10px 20px', maxWidth: 'fit-content',}}>
Название кнопки
</Button>
</Box>
</ContactFormParent>
<ContactFormParent>
<Box sx={{display: 'flex', alignItems: 'center', justifyContent: 'end'}}>
<OneIcon/>
<IconButton> <ExpandMoreIcon /> </IconButton>
</Box>
<Button variant='contained' sx={{maxWidth: 'fit-content', padding: '10px 20px'}}>
Добавить поле +
</Button>
<Box sx={{display: 'flex'}}>
<Typography sx={{color: theme.palette.orange.main}}>Будут показаны поля по умолчанию</Typography>
<InfoIcon/>
</Box>
<Link sx={{
mt: "20px",
fontSize: "16px",
lineHeight: "19px",
color: theme.palette.brightPurple.main,
textDecorationColor: theme.palette.brightPurple.main
}}>Добавить мессенджеры</Link>
<Button variant='contained' sx={{padding: '10px 20px', maxWidth: 'fit-content',}}>
Название кнопки
</Button>
</ContactFormParent>
<Box sx={{display: 'flex',justifyContent: 'space-between', maxWidth: '796px'}}>
<IconButton>
<AddPlus/>
</IconButton>
<Box sx={{display: 'flex', gap: '8px'}}>
<Button variant='outlined'>
<ArrowLeft/>
</Button>
<Button variant='contained' sx={{padding: '10px 20px'}}>
Установка квиза
</Button>
</Box>
</Box>
</>
)
}
interface Props {
outerContainerSx?: SxProps<Theme>;
children?: React.ReactNode;
}
function ContactFormParent({outerContainerSx: sx, children }: Props) {
const theme = useTheme();
const [switchState, setSwitchState] = React.useState('setting');
const SSHC = (data: string) => {
setSwitchState(data)
}
return(
<Paper sx={{maxWidth: '796px', width: '100%', borderRadius: '12px', margin: '20px 0', display: 'flex', flexDirection: 'column'}}>
<Box sx={{width: '100%', display: 'flex'}} >
<Box <Box
sx={{ sx={{
borderRight: `1px solid ${theme.palette.grey2.main}`, borderRight: `1px solid ${theme.palette.grey2.main}`,
@ -46,64 +135,30 @@ export default function ContactFormPage() {
gap: '20px' gap: '20px'
}}> }}>
<CustomTextField placeholder="Заголовок формы" text={""}/> <CustomTextField placeholder="Заголовок формы" text={""}/>
<CustomTextField placeholder="Дополнительный текст формы" text={""} <TextField
sx={{ id="outlined-multiline-static"
"& .MuiInputBase-root": { multiline
height: "48px", rows={8}
borderRadius: "10px", placeholder="Дополнительный текст формы"
minHeight: '287px', sx={{
alignItems: 'start', backgroundColor: theme.palette.background.default,
},
}} /> "& .MuiInputBase-root": {
borderRadius: "10px",
alignItems: 'start',
color: theme.palette.grey2.main,
},
}}
/>
</Box> </Box>
<Box sx={{display: 'flex', flexDirection: 'column', padding: '20px', width: '100%'}}> <Box sx={{display: 'flex', flexDirection: 'column', padding: '20px', width: '100%', gap: '20px'}}>
<Box sx={{display: 'flex', alignItems: 'center', justifyContent: 'end'}}> {children}
<OneIcon/>
<IconButton> <ExpandMoreIcon /> </IconButton>
</Box>
<Box sx={{display: 'flex', flexDirection: 'column', gap: '20px', padding: '10px 20px'}}>
<Typography>Имя*</Typography>
<CustomTextField placeholder="Дмитрий" text={""} />
<Typography>E-mail*</Typography>
<CustomTextField placeholder="+7 900 000 00 00" text={""} />
<Typography>Телефон*</Typography>
<CustomTextField placeholder="+7 900 000 00 00" text={""} />
<Button variant='main' sx={{maxWidth: 'fit-content', padding: '10px 20px'}}>
Добавить поле +
</Button>
<Link sx={{
mt: "20px",
fontSize: "16px",
lineHeight: "19px",
color: theme.palette.brightPurple.main,
textDecorationColor: theme.palette.brightPurple.main
}}>Добавить мессенджеры</Link>
<Button variant='main' sx={{padding: '10px 20px', maxWidth: 'fit-content',}}>
Название кнопки
</Button>
</Box>
</Box>
{/*<Box*/}
{/* sx={{width: '100%', maxWidth: "760px", display: 'flex', alignItems: 'center', gap: '10px', padding: '20px' }}*/}
{/*>*/}
{/*</Box>*/}
</Paper>
<Box sx={{display: 'flex',justifyContent: 'space-between', maxWidth: '796px'}}>
<IconButton>
<AddPlus/>
</IconButton>
<Box sx={{display: 'flex', gap: '8px'}}>
<Button variant='outmain'>
<ArrowLeft/>
</Button>
<Button variant='main' sx={{padding: '10px 20px'}}>
Установка квиза
</Button>
</Box> </Box>
</Box> </Box>
</> <Box>
<ButtonSettingForms switchState={switchState} SSHC={SSHC}/>
<SwitchContactForm switchState={switchState}/>
</Box>
</Paper>
) )
} }

@ -7,17 +7,28 @@ import {SxProps, Theme} from "@mui/material";
interface Props { interface Props {
outerContainerSx?: SxProps<Theme>; outerContainerSx?: SxProps<Theme>;
children?: React.ReactNode; children?: React.ReactNode;
isOpen: boolean;
openHC: (arg0: boolean) => void
} }
export default function DrawerNewField({outerContainerSx: sx, children, isOpen, openHC }: Props) { export default function DrawerNewField({outerContainerSx: sx, children }: Props) {
const [state, setState] = React.useState({
right: false,
});
const toggleDrawer =
(anchor: 'right', open: boolean) =>
() => {
setState({ ...state, 'right' : open });
};
return ( return (
<> <>
<Button onClick={toggleDrawer("right", true)} variant='contained' sx={{maxWidth: 'fit-content', padding: '10px 20px'}}>
Добавить поле +
</Button>
<Drawer <Drawer
anchor='right' anchor='right'
open={isOpen} open={state['right']}
onClose={() => openHC(false)} onClose={toggleDrawer("right", false)}
> >
<Box <Box
sx={{ width: 450 }} sx={{ width: 450 }}

@ -15,7 +15,7 @@ export default function WindowMessengers() {
const [selectMessenger, setSelectMessenger] = useState<SelectMessenger>("contact"); const [selectMessenger, setSelectMessenger] = useState<SelectMessenger>("contact");
return( return(
<> <>
<Box sx={{padding: '10px 10px 10px 20px', display: 'flex', justifyContent: 'space-between', alignItems: 'center', background: theme.palette.background.default}}> <Box sx={{padding: '10px 10px 10px 20px', display: 'flex', justifyContent: 'space-between', alignItems: 'center', width: '100%', background: theme.palette.background.default}}>
<Typography>Настройки мессенджеров</Typography> <Typography>Настройки мессенджеров</Typography>
<Button sx={{padding: 0}}><CloseIcon fontSize='large'/></Button> <Button sx={{padding: 0}}><CloseIcon fontSize='large'/></Button>
</Box> </Box>
@ -61,7 +61,6 @@ export default function WindowMessengers() {
: :
<></> <></>
} }
<Button variant='contained' sx={{maxWidth: '125px', margin: '20px'}}>Добавить</Button>
</> </>
) )
} }

@ -26,6 +26,11 @@ export default function ButtonsNewField ({SSHC, switchState}:Props) {
] ]
return ( return (
<Box sx={{
display: 'flex',
justifyContent: 'space-between',
width: '100%',
}}>
<Box <Box
sx={{ sx={{
padding: '20px', padding: '20px',
@ -46,5 +51,6 @@ export default function ButtonsNewField ({SSHC, switchState}:Props) {
</MiniButtonSetting> </MiniButtonSetting>
))} ))}
</Box> </Box>
</Box>
) )
} }

@ -34,7 +34,7 @@ export default function NewFieldParent ({defaultValue, placeholderHelp, placehol
<TextField <TextField
disabled disabled
id="outlined-disabled" id="outlined-disabled"
value={defaultValue} defaultValue={defaultValue}
sx={{ sx={{
"& .css-1d3z3hw-MuiOutlinedInput-notchedOutline": { "& .css-1d3z3hw-MuiOutlinedInput-notchedOutline": {
border: 'none' border: 'none'

@ -11,10 +11,6 @@ interface Props {
export default function SwitchNewField({switchState ='name'}: Props) { export default function SwitchNewField({switchState ='name'}: Props) {
const [SwitchMask, setSwitchMask] = React.useState(false);
const SwitchMaskHC = (bool:boolean) => {
setSwitchMask(bool)
}
switch (switchState) { switch (switchState) {
case 'name': case 'name':
return (<NewFieldParent placeholderHelp={'Введите имя'} placeholderField={'Дмитрий'} defaultValue={'name'}/>); return (<NewFieldParent placeholderHelp={'Введите имя'} placeholderField={'Дмитрий'} defaultValue={'name'}/>);
@ -35,16 +31,8 @@ export default function SwitchNewField({switchState ='name'}: Props) {
display: 'flex', display: 'flex',
justifyContent: 'space-between' justifyContent: 'space-between'
}} }}
onClick={() => {
SwitchMaskHC(!SwitchMask)
}}
/> />
{SwitchMask ? <SelectMask/>
<SelectMask/>
:
<></>
}
</NewFieldParent> </NewFieldParent>
); );
break; break;

@ -10,7 +10,7 @@ import {useState} from "react";
export default function WindowNewField() { export default function WindowNewField() {
const theme = useTheme(); const theme = useTheme();
const [switchState, setSwitchState] = React.useState('name'); const [switchState, setSwitchState] = React.useState('setting');
const SSHC = (data: string) => { const SSHC = (data: string) => {
setSwitchState(data) setSwitchState(data)
} }
@ -18,7 +18,7 @@ export default function WindowNewField() {
return( return(
<> <>
<Box sx={{padding: '10px 10px 10px 20px', display: 'flex', justifyContent: 'space-between', alignItems: 'center', background: theme.palette.background.default}}> <Box sx={{padding: '10px 10px 10px 20px', display: 'flex', justifyContent: 'space-between', alignItems: 'center', width: '100%', background: theme.palette.background.default}}>
<Typography>Новое поле</Typography> <Typography>Новое поле</Typography>
<Button sx={{padding: 0}}><CloseIcon fontSize='large'/></Button> <Button sx={{padding: 0}}><CloseIcon fontSize='large'/></Button>
</Box> </Box>

@ -7,10 +7,10 @@ import {useState} from "react";
type SelectMask = 'country'| 'mymask'; type SelectMask = 'country'| 'mymask';
export default function SelectMask () { export default function SelectMask () {
const [State, setState] = React.useState(false); // const [State, setState] = React.useState('');
const StateHC = (bool:boolean) => { // const StateHC = (data: string) => {
setState(bool) // setState(data)
} // }
const theme = useTheme() const theme = useTheme()
const [selectMask, setSelectMask] = useState<SelectMask>("country"); const [selectMask, setSelectMask] = useState<SelectMask>("country");
@ -37,39 +37,34 @@ export default function SelectMask () {
component="button" component="button"
variant="body2" variant="body2"
sx={{color: theme.palette.brightPurple.main, textAlign: 'left'}} sx={{color: theme.palette.brightPurple.main, textAlign: 'left'}}
onClick={() => { // onClick={() => {
StateHC(!State) // StateHC()
}} // }}
> >
Расширенные настройки Расширенные настройки
</Link> </Link>
{State ? <Box sx={{display: 'flex', flexDirection: 'column', gap: '20px'}}>
<Box sx={{display: 'flex', flexDirection: 'column', gap: '20px'}}> <Box sx={{display: 'flex', flexDirection: 'column', gap: '10px'}}>
<Box sx={{display: 'flex', flexDirection: 'column', gap: '10px'}}> <Typography>Страна по умолчанию</Typography>
<Typography>Страна по умолчанию</Typography> <CustomTextField placeholder={'Введите страну на английском языке'}/>
<CustomTextField placeholder={'Введите страну на английском языке'}/> <Typography sx={{fontSize: "12px", lineHeight: "14px"}}>Если ничего не выбрано, страна будет выбрана автоматически</Typography>
<Typography sx={{fontSize: "12px", lineHeight: "14px"}}>Если ничего не выбрано, страна будет выбрана автоматически</Typography>
</Box>
<Box sx={{display: 'flex', flexDirection: 'column', gap: '10px'}}>
<Typography>Выделенные страны</Typography>
<CustomTextField placeholder={'Введите страну на английском языке'}/>
<Typography sx={{fontSize: "12px", lineHeight: "14px"}}>Выбранные страны будут показываться вверху списка</Typography>
</Box>
<Box sx={{display: 'flex', flexDirection: 'column', gap: '10px'}}>
<Typography>Показываемые страны</Typography>
<CustomTextField placeholder={'Введите страну на английском языке'}/>
<Typography sx={{fontSize: "12px", lineHeight: "14px"}}>Будут показываться только выбранные страны</Typography>
</Box>
<Box sx={{display: 'flex', flexDirection: 'column', gap: '10px'}}>
<Typography>Игнорируемые страны</Typography>
<CustomTextField placeholder={'Введите страну на английском языке'}/>
<Typography sx={{fontSize: "12px", lineHeight: "14px"}}>Выбранные страны будут не будут показываться в списке</Typography>
</Box>
</Box> </Box>
: <Box sx={{display: 'flex', flexDirection: 'column', gap: '10px'}}>
<></> <Typography>Выделенные страны</Typography>
} <CustomTextField placeholder={'Введите страну на английском языке'}/>
<Typography sx={{fontSize: "12px", lineHeight: "14px"}}>Выбранные страны будут показываться вверху списка</Typography>
</Box>
<Box sx={{display: 'flex', flexDirection: 'column', gap: '10px'}}>
<Typography>Показываемые страны</Typography>
<CustomTextField placeholder={'Введите страну на английском языке'}/>
<Typography sx={{fontSize: "12px", lineHeight: "14px"}}>Будут показываться только выбранные страны</Typography>
</Box>
<Box sx={{display: 'flex', flexDirection: 'column', gap: '10px'}}>
<Typography>Игнорируемые страны</Typography>
<CustomTextField placeholder={'Введите страну на английском языке'}/>
<Typography sx={{fontSize: "12px", lineHeight: "14px"}}>Выбранные страны будут не будут показываться в списке</Typography>
</Box>
</Box>
</> </>
: :
<> <>

@ -1,4 +1,6 @@
import * as React from 'react'; import * as React from 'react';
import SettingForm from "./settingForm";
import BranchingForm from "./BranchingForm";
@ -6,17 +8,17 @@ interface Props {
switchState: string, switchState: string,
} }
export default function SwitchAnswerOptions({switchState = 'setting' }: Props) { export default function SwitchContactForm({switchState = 'setting' }: Props) {
switch (switchState) { switch (switchState) {
case 'setting': case 'setting':
// return (<ResponseSettings/>); return (<SettingForm/>);
break; break;
case 'branching': case 'branching':
// return (<BranchingQuestions/>); return (<BranchingForm/>);
break; break;
case 'supplement': case 'supplement':
// return (<UploadImage/>); return (<></>);
break; break;
default: default:
return (<></>) return (<></>)

@ -2,7 +2,7 @@ import {FormControl, TextField, useTheme, SxProps, Theme} from "@mui/material";
interface CustomTextFieldProps { interface CustomTextFieldProps {
placeholder: string; placeholder: string;
text: string; text?: string;
sx?: SxProps<Theme>; sx?: SxProps<Theme>;
} }
@ -16,12 +16,12 @@ export default function CustomTextField({ placeholder, text, sx}: CustomTextFiel
sx={{ p: 0 }} sx={{ p: 0 }}
> >
<TextField <TextField
// value={text} value={text}
fullWidth fullWidth
placeholder={placeholder} placeholder={placeholder}
sx={{ sx={{
backgroundColor: theme.palette.background.default,
"& .MuiInputBase-root": { "& .MuiInputBase-root": {
backgroundColor: theme.palette.background.default,
height: "48px", height: "48px",
borderRadius: "10px", borderRadius: "10px",

@ -29,7 +29,7 @@ const theme = createTheme({
variants: [ variants: [
{ {
props: { props: {
variant: 'main' }, variant: 'contained' },
style: { style: {
backgroundColor: "#7E2AEA", backgroundColor: "#7E2AEA",
padding: '13px 20px', padding: '13px 20px',
@ -43,7 +43,7 @@ const theme = createTheme({
}, },
{ {
props: { props: {
variant: 'outmain' }, variant: 'outlined' },
style: { style: {
backgroundColor: "#F2F3F7", backgroundColor: "#F2F3F7",
padding: '10px 20px', padding: '10px 20px',