Merge branch 'dev' of penahub.gitlab.yandexcloud.net:frontend/squiz into dev
This commit is contained in:
commit
7e84a3006b
190
src/pages/InstallQuiz/QuizInstallationCard/WidgetSetupByType/BannerWidgetSetup/BannerWidgetSetup.tsx
190
src/pages/InstallQuiz/QuizInstallationCard/WidgetSetupByType/BannerWidgetSetup/BannerWidgetSetup.tsx
@ -37,21 +37,17 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
const quiz = useCurrentQuiz();
|
const quiz = useCurrentQuiz();
|
||||||
const [widgetWidth, setWidgetWidth] = useState<string>("");
|
const [widgetWidth, setWidgetWidth] = useState<string>("");
|
||||||
const [widgetHeight, setWidgetHeight] = useState<string>("");
|
const [widgetHeight, setWidgetHeight] = useState<string>("");
|
||||||
const [isAutoopenQuizSettingsOpen, setIsAutoopenQuizSettingsOpen] =
|
const [isAutoopenQuizSettingsOpen, setIsAutoopenQuizSettingsOpen] = useState<boolean>(false);
|
||||||
useState<boolean>(false);
|
|
||||||
const [hideOnMobile, setHideOnMobile] = useState<boolean>(false);
|
const [hideOnMobile, setHideOnMobile] = useState<boolean>(false);
|
||||||
const [rounded, setRounded] = useState<boolean>(false);
|
const [rounded, setRounded] = useState<boolean>(false);
|
||||||
const [withShadow, setWithShadow] = useState<boolean>(false);
|
const [withShadow, setWithShadow] = useState<boolean>(false);
|
||||||
const [buttonFlash, setButtonFlash] = useState<boolean>(false);
|
const [buttonFlash, setButtonFlash] = useState<boolean>(false);
|
||||||
const [buttonBackgroundColor, setButtonBackgroundColor] = useState<string>(
|
const [buttonBackgroundColor, setButtonBackgroundColor] = useState<string>(theme.palette.brightPurple.main);
|
||||||
theme.palette.brightPurple.main,
|
|
||||||
);
|
|
||||||
const [buttonTextColor, setButtonTextColor] = useState<string>("#FFFFFF");
|
const [buttonTextColor, setButtonTextColor] = useState<string>("#FFFFFF");
|
||||||
const [autoShowQuiz, setAutoShowQuiz] = useState<boolean>(false);
|
const [autoShowQuiz, setAutoShowQuiz] = useState<boolean>(false);
|
||||||
const [autoShowQuizTime, setAutoShowQuizTime] = useState<number>(10);
|
const [autoShowQuizTime, setAutoShowQuizTime] = useState<number>(10);
|
||||||
const [openOnLeaveAttempt, setOpenOnLeaveAttempt] = useState<boolean>(false);
|
const [openOnLeaveAttempt, setOpenOnLeaveAttempt] = useState<boolean>(false);
|
||||||
const [position, setPosition] =
|
const [position, setPosition] = useState<BannerWidgetParams["position"]>("bottomleft");
|
||||||
useState<BannerWidgetParams["position"]>("bottomleft");
|
|
||||||
const [bannerFullWidth, setBannerFullWidth] = useState<boolean>(false);
|
const [bannerFullWidth, setBannerFullWidth] = useState<boolean>(false);
|
||||||
const [autoShowWidgetTime, setAutoShowWidgetTime] = useState<number>(10);
|
const [autoShowWidgetTime, setAutoShowWidgetTime] = useState<number>(10);
|
||||||
const [appealText, setAppealText] = useState<string>("");
|
const [appealText, setAppealText] = useState<string>("");
|
||||||
@ -88,12 +84,7 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
: undefined,
|
: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return <WidgetScript scriptText={scriptText} helperText="Установите код внутрь тэга head" />;
|
||||||
<WidgetScript
|
|
||||||
scriptText={scriptText}
|
|
||||||
helperText="Установите код внутрь тэга head"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -129,17 +120,39 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
sx={[
|
sx={[
|
||||||
{
|
{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
top: "calc(12.5 / 262 * 100%)",
|
|
||||||
left: "calc(50.6 / 520 * 100%)",
|
|
||||||
width: "calc(196 / 520 * 100%)",
|
width: "calc(196 / 520 * 100%)",
|
||||||
height: "calc(30 / 262 * 100%)",
|
height: "calc(30 / 262 * 100%)",
|
||||||
},
|
},
|
||||||
bannerFullWidth && {
|
position === "topleft" && {
|
||||||
top: "calc(7 / 262 * 100%)",
|
top: "calc(12.5 / 262 * 100%)",
|
||||||
left: "calc(45 / 520 * 100%)",
|
left: "calc(50.6 / 520 * 100%)",
|
||||||
width: "calc(348 / 520 * 100%)",
|
|
||||||
height: "calc(30 / 262 * 100%)",
|
|
||||||
},
|
},
|
||||||
|
position === "topright" && {
|
||||||
|
top: "calc(12.5 / 262 * 100%)",
|
||||||
|
left: "calc(190 / 520 * 100%)",
|
||||||
|
},
|
||||||
|
position === "bottomleft" && {
|
||||||
|
top: "calc(178 / 262 * 100%)",
|
||||||
|
left: "calc(50.6 / 520 * 100%)",
|
||||||
|
},
|
||||||
|
position === "bottomright" && {
|
||||||
|
top: "calc(178 / 262 * 100%)",
|
||||||
|
left: "calc(190 / 520 * 100%)",
|
||||||
|
},
|
||||||
|
bannerFullWidth &&
|
||||||
|
position.startsWith("top") && {
|
||||||
|
top: "calc(7 / 262 * 100%)",
|
||||||
|
left: "calc(45 / 520 * 100%)",
|
||||||
|
width: "calc(348 / 520 * 100%)",
|
||||||
|
height: "calc(30 / 262 * 100%)",
|
||||||
|
},
|
||||||
|
bannerFullWidth &&
|
||||||
|
position.startsWith("bottom") && {
|
||||||
|
top: "calc(185 / 262 * 100%)",
|
||||||
|
left: "calc(45 / 520 * 100%)",
|
||||||
|
width: "calc(348 / 520 * 100%)",
|
||||||
|
height: "calc(30 / 262 * 100%)",
|
||||||
|
},
|
||||||
pulsation && {
|
pulsation && {
|
||||||
":before": {
|
":before": {
|
||||||
content: "''",
|
content: "''",
|
||||||
@ -196,16 +209,10 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
color: "white",
|
color: "white",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography fontSize="calc(6 / 29.5 * 100cqh)" lineHeight="120%">
|
||||||
fontSize="calc(6 / 29.5 * 100cqh)"
|
|
||||||
lineHeight="120%"
|
|
||||||
>
|
|
||||||
{appealText || "Пройти тест"}
|
{appealText || "Пройти тест"}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography fontSize="calc(11 / 29.5 * 100cqh)" lineHeight="120%">
|
||||||
fontSize="calc(11 / 29.5 * 100cqh)"
|
|
||||||
lineHeight="120%"
|
|
||||||
>
|
|
||||||
{quizHeaderText || "Заголовок теста"}
|
{quizHeaderText || "Заголовок теста"}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
@ -220,8 +227,7 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
height: "calc(10 / 29.5 * 100%)",
|
height: "calc(10 / 29.5 * 100%)",
|
||||||
width: "auto",
|
width: "auto",
|
||||||
aspectRatio: 1,
|
aspectRatio: 1,
|
||||||
backgroundColor:
|
backgroundColor: rounded || bannerFullWidth ? "#581CA7" : undefined,
|
||||||
rounded || bannerFullWidth ? "#581CA7" : undefined,
|
|
||||||
borderRadius: "50%",
|
borderRadius: "50%",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@ -255,9 +261,7 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
gap: "20px",
|
gap: "20px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography sx={{ color: theme.palette.grey2.main }}>
|
<Typography sx={{ color: theme.palette.grey2.main }}>Ширина окна (px)</Typography>
|
||||||
Ширина окна (px)
|
|
||||||
</Typography>
|
|
||||||
<PenaTextField
|
<PenaTextField
|
||||||
type="number"
|
type="number"
|
||||||
value={widgetWidth}
|
value={widgetWidth}
|
||||||
@ -273,9 +277,7 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
gap: "20px",
|
gap: "20px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography sx={{ color: theme.palette.grey2.main }}>
|
<Typography sx={{ color: theme.palette.grey2.main }}>Высота окна (px)</Typography>
|
||||||
Высота окна (px)
|
|
||||||
</Typography>
|
|
||||||
<PenaTextField
|
<PenaTextField
|
||||||
type="number"
|
type="number"
|
||||||
value={widgetHeight}
|
value={widgetHeight}
|
||||||
@ -286,18 +288,14 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
<Typography sx={{ color: theme.palette.grey2.main }}>
|
<Typography sx={{ color: theme.palette.grey2.main }}>Текст-призыв</Typography>
|
||||||
Текст-призыв
|
|
||||||
</Typography>
|
|
||||||
<PenaTextField
|
<PenaTextField
|
||||||
placeholder="Пройти тест"
|
placeholder="Пройти тест"
|
||||||
value={appealText}
|
value={appealText}
|
||||||
onChange={(e) => setAppealText(e.target.value)}
|
onChange={(e) => setAppealText(e.target.value)}
|
||||||
FormControlSx={{ maxWidth: "360px" }}
|
FormControlSx={{ maxWidth: "360px" }}
|
||||||
/>
|
/>
|
||||||
<Typography sx={{ color: theme.palette.grey2.main }}>
|
<Typography sx={{ color: theme.palette.grey2.main }}>Заголовок quiz</Typography>
|
||||||
Заголовок quiz
|
|
||||||
</Typography>
|
|
||||||
<PenaTextField
|
<PenaTextField
|
||||||
placeholder="Заголовок quiz"
|
placeholder="Заголовок quiz"
|
||||||
value={quizHeaderText}
|
value={quizHeaderText}
|
||||||
@ -311,9 +309,7 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography sx={{ color: theme.palette.grey2.main }}>
|
<Typography sx={{ color: theme.palette.grey2.main }}>Показывать через</Typography>
|
||||||
Показывать через
|
|
||||||
</Typography>
|
|
||||||
<PenaTextField
|
<PenaTextField
|
||||||
type="number"
|
type="number"
|
||||||
value={autoShowWidgetTime}
|
value={autoShowWidgetTime}
|
||||||
@ -322,9 +318,7 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
width: "90px",
|
width: "90px",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Typography sx={{ color: theme.palette.grey2.main }}>
|
<Typography sx={{ color: theme.palette.grey2.main }}>секунд</Typography>
|
||||||
секунд
|
|
||||||
</Typography>
|
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -333,20 +327,10 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography sx={{ color: theme.palette.grey2.main }}>
|
<Typography sx={{ color: theme.palette.grey2.main }}>Цвет кнопки</Typography>
|
||||||
Цвет кнопки
|
<CircleColorPicker color={buttonBackgroundColor} onChange={(color) => setButtonBackgroundColor(color)} />
|
||||||
</Typography>
|
<Typography sx={{ color: theme.palette.grey2.main }}>Цвет текста кнопки</Typography>
|
||||||
<CircleColorPicker
|
<CircleColorPicker color={buttonTextColor} onChange={(color) => setButtonTextColor(color)} />
|
||||||
color={buttonBackgroundColor}
|
|
||||||
onChange={(color) => setButtonBackgroundColor(color)}
|
|
||||||
/>
|
|
||||||
<Typography sx={{ color: theme.palette.grey2.main }}>
|
|
||||||
Цвет текста кнопки
|
|
||||||
</Typography>
|
|
||||||
<CircleColorPicker
|
|
||||||
color={buttonTextColor}
|
|
||||||
onChange={(color) => setButtonTextColor(color)}
|
|
||||||
/>
|
|
||||||
</Box>
|
</Box>
|
||||||
<CustomCheckbox
|
<CustomCheckbox
|
||||||
label="Баннер на всю ширину экрана"
|
label="Баннер на всю ширину экрана"
|
||||||
@ -356,9 +340,7 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
if (e.target.checked) setPosition("topleft");
|
if (e.target.checked) setPosition("topleft");
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Typography sx={{ color: theme.palette.grey2.main }}>
|
<Typography sx={{ color: theme.palette.grey2.main }}>Расположение</Typography>
|
||||||
Расположение
|
|
||||||
</Typography>
|
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
value={position}
|
value={position}
|
||||||
@ -384,17 +366,13 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
label="Сверху страницы"
|
label="Сверху страницы"
|
||||||
value="topleft"
|
value="topleft"
|
||||||
control={
|
control={<Radio checkedIcon={<RadioCheck />} icon={<RadioIcon />} />}
|
||||||
<Radio checkedIcon={<RadioCheck />} icon={<RadioIcon />} />
|
|
||||||
}
|
|
||||||
sx={{ color: theme.palette.grey2.main }}
|
sx={{ color: theme.palette.grey2.main }}
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
label="Снизу страницы"
|
label="Снизу страницы"
|
||||||
value="bottomleft"
|
value="bottomleft"
|
||||||
control={
|
control={<Radio checkedIcon={<RadioCheck />} icon={<RadioIcon />} />}
|
||||||
<Radio checkedIcon={<RadioCheck />} icon={<RadioIcon />} />
|
|
||||||
}
|
|
||||||
sx={{ color: theme.palette.grey2.main }}
|
sx={{ color: theme.palette.grey2.main }}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
@ -409,23 +387,13 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
label="Слева сверху"
|
label="Слева сверху"
|
||||||
value="topleft"
|
value="topleft"
|
||||||
control={
|
control={<Radio checkedIcon={<RadioCheck />} icon={<RadioIcon />} />}
|
||||||
<Radio
|
|
||||||
checkedIcon={<RadioCheck />}
|
|
||||||
icon={<RadioIcon />}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
sx={{ color: theme.palette.grey2.main }}
|
sx={{ color: theme.palette.grey2.main }}
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
label="Справа сверху"
|
label="Слева снизу"
|
||||||
value="topright"
|
value="bottomleft"
|
||||||
control={
|
control={<Radio checkedIcon={<RadioCheck />} icon={<RadioIcon />} />}
|
||||||
<Radio
|
|
||||||
checkedIcon={<RadioCheck />}
|
|
||||||
icon={<RadioIcon />}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
sx={{ color: theme.palette.grey2.main }}
|
sx={{ color: theme.palette.grey2.main }}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
@ -436,25 +404,15 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
label="Слева снизу"
|
label="Справа сверху"
|
||||||
value="bottomleft"
|
value="topright"
|
||||||
control={
|
control={<Radio checkedIcon={<RadioCheck />} icon={<RadioIcon />} />}
|
||||||
<Radio
|
|
||||||
checkedIcon={<RadioCheck />}
|
|
||||||
icon={<RadioIcon />}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
sx={{ color: theme.palette.grey2.main }}
|
sx={{ color: theme.palette.grey2.main }}
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
label="Справа снизу"
|
label="Справа снизу"
|
||||||
value="bottomright"
|
value="bottomright"
|
||||||
control={
|
control={<Radio checkedIcon={<RadioCheck />} icon={<RadioIcon />} />}
|
||||||
<Radio
|
|
||||||
checkedIcon={<RadioCheck />}
|
|
||||||
icon={<RadioIcon />}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
sx={{ color: theme.palette.grey2.main }}
|
sx={{ color: theme.palette.grey2.main }}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
@ -462,26 +420,12 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
)}
|
)}
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<Typography sx={{ color: theme.palette.grey2.main }}>
|
<Typography sx={{ color: theme.palette.grey2.main }}>Параметры</Typography>
|
||||||
Параметры
|
|
||||||
</Typography>
|
|
||||||
{!bannerFullWidth && (
|
{!bannerFullWidth && (
|
||||||
<CustomCheckbox
|
<CustomCheckbox label="Закругленная" checked={rounded} handleChange={(e) => setRounded(e.target.checked)} />
|
||||||
label="Закругленная"
|
|
||||||
checked={rounded}
|
|
||||||
handleChange={(e) => setRounded(e.target.checked)}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
<CustomCheckbox
|
<CustomCheckbox label="С тенью" checked={withShadow} handleChange={(e) => setWithShadow(e.target.checked)} />
|
||||||
label="С тенью"
|
<CustomCheckbox label="С бликом" checked={buttonFlash} handleChange={(e) => setButtonFlash(e.target.checked)} />
|
||||||
checked={withShadow}
|
|
||||||
handleChange={(e) => setWithShadow(e.target.checked)}
|
|
||||||
/>
|
|
||||||
<CustomCheckbox
|
|
||||||
label="С бликом"
|
|
||||||
checked={buttonFlash}
|
|
||||||
handleChange={(e) => setButtonFlash(e.target.checked)}
|
|
||||||
/>
|
|
||||||
<CustomCheckbox
|
<CustomCheckbox
|
||||||
label={'Эффект "пульсация"'}
|
label={'Эффект "пульсация"'}
|
||||||
checked={pulsation}
|
checked={pulsation}
|
||||||
@ -546,22 +490,16 @@ export default function BannerWidgetSetup({ step, nextButton }: Props) {
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography sx={{ color: theme.palette.grey2.main }}>
|
<Typography sx={{ color: theme.palette.grey2.main }}>Показывать через</Typography>
|
||||||
Показывать через
|
|
||||||
</Typography>
|
|
||||||
<PenaTextField
|
<PenaTextField
|
||||||
type="number"
|
type="number"
|
||||||
value={autoShowQuizTime}
|
value={autoShowQuizTime}
|
||||||
onChange={(e) =>
|
onChange={(e) => setAutoShowQuizTime(parseInt(e.target.value))}
|
||||||
setAutoShowQuizTime(parseInt(e.target.value))
|
|
||||||
}
|
|
||||||
FormControlSx={{
|
FormControlSx={{
|
||||||
width: "90px",
|
width: "90px",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Typography sx={{ color: theme.palette.grey2.main }}>
|
<Typography sx={{ color: theme.palette.grey2.main }}>секунд</Typography>
|
||||||
секунд
|
|
||||||
</Typography>
|
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
|
Loading…
Reference in New Issue
Block a user