кнопка добавления имени виджета

This commit is contained in:
Nastya 2024-12-20 18:26:56 +03:00
parent 6bb0e59979
commit 9b1410abf8
2 changed files with 24 additions and 9 deletions

@ -4,9 +4,10 @@ import RunningStripe from "@ui_kit/RunningStripe";
interface Props {
position: "left" | "right";
buttonFlash: boolean;
text: string;
}
export default function SideWidgetPreviewDesktop({ buttonFlash, position }: Props) {
export default function SideWidgetPreviewDesktop({ buttonFlash, position, text }: Props) {
return (
<Box
sx={[
@ -46,7 +47,7 @@ export default function SideWidgetPreviewDesktop({ buttonFlash, position }: Prop
fontSize="40cqh"
color="white"
>
Пройти квиз
{ text || "Пройти квиз" }
</Typography>
{buttonFlash && <RunningStripe />}
</Box>

@ -12,6 +12,7 @@ import { useWidgetUrl } from "../../useWidgetUrl";
import SideWidgetPositionButton from "./SideWidgetPositionButton";
import SideWidgetPreviewDesktop from "./SideWidgetPreviewDesktop";
import SideWidgetPreviewMobile from "./SideWidgetPreviewMobile";
import CustomTextField from "@ui_kit/CustomTextField";
interface Props {
step: 2 | 3;
@ -30,6 +31,7 @@ export default function SideWidgetSetup({ step, nextButton }: Props) {
const [autoShowQuizTime, setAutoShowQuizTime] = useState<number>(10);
const [autoShowWidgetTime, setAutoShowWidgetTime] = useState<number>(10);
const [position, setPosition] = useState<SideWidgetParams["position"]>("left");
const [buttonText, setButtonText] = useState<string>("Пройти квиз");
const [fullScreen, setFullScreen] = useState<boolean>(false);
const [buttonFlash, setButtonFlash] = useState<boolean>(false);
const [buttonBackgroundColor, setButtonBackgroundColor] = useState<string>(theme.palette.brightPurple.main);
@ -48,13 +50,14 @@ export default function SideWidgetSetup({ step, nextButton }: Props) {
fullScreen: fullScreen || undefined,
buttonFlash: buttonFlash || undefined,
buttonTextColor,
buttonText: buttonText,
buttonBackgroundColor,
dialogDimensions:
!fullScreen && (widgetWidth || widgetHeight)
? {
width: widgetWidth ? `${widgetWidth}px` : "100%",
height: widgetHeight ? `${widgetHeight}px` : "100%",
}
width: widgetWidth ? `${widgetWidth}px` : "100%",
height: widgetHeight ? `${widgetHeight}px` : "100%",
}
: undefined,
},
widgetUrl
@ -100,6 +103,7 @@ export default function SideWidgetSetup({ step, nextButton }: Props) {
<SideWidgetPreviewDesktop
position={position}
buttonFlash={buttonFlash}
text={buttonText}
/>
<SideWidgetPreviewMobile buttonFlash={buttonFlash} />
</Box>
@ -274,10 +278,20 @@ export default function SideWidgetSetup({ step, nextButton }: Props) {
</Typography>
</Collapse>
</Box>
<CustomCheckbox
label="Отключить на мобильных устройствах"
checked={hideOnMobile}
handleChange={(e) => setHideOnMobile(e.target.checked)}
<Typography sx={{ color: theme.palette.grey2.main }}>Текст кнопки</Typography>
<CustomTextField
id="headingInput"
onChange={(e) => setButtonText(e.target.value)}
placeholder="Пройти тест"
value={buttonText}
sx={{
borderColor: theme.palette.brightPurple.main,
}}
sxForm={{
maxWidth: "360px",
}}
maxLength={17}
/>
<Box
sx={{