add fullscreen param to widgets
This commit is contained in:
parent
7b1fafe372
commit
9271bbb80d
@ -22,6 +22,7 @@ export interface BannerWidgetComponentProps {
|
|||||||
rounded?: boolean;
|
rounded?: boolean;
|
||||||
bannerFullWidth?: boolean;
|
bannerFullWidth?: boolean;
|
||||||
pulsation?: boolean;
|
pulsation?: boolean;
|
||||||
|
fullScreen?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BannerWidgetParams = Omit<BannerWidgetComponentProps, "onWidgetClose">;
|
export type BannerWidgetParams = Omit<BannerWidgetComponentProps, "onWidgetClose">;
|
||||||
|
@ -14,6 +14,7 @@ export interface ButtonWidgetComponentProps {
|
|||||||
buttonText?: string;
|
buttonText?: string;
|
||||||
buttonTextColor?: string;
|
buttonTextColor?: string;
|
||||||
buttonBackgroundColor?: string;
|
buttonBackgroundColor?: string;
|
||||||
|
fullScreen?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ButtonWidgetParams = Omit<ButtonWidgetComponentProps, "fixedSide"> & {
|
export type ButtonWidgetParams = Omit<ButtonWidgetComponentProps, "fixedSide"> & {
|
||||||
|
@ -7,6 +7,7 @@ export interface PopupWidgetComponentProps {
|
|||||||
autoShowQuizTime?: number | null;
|
autoShowQuizTime?: number | null;
|
||||||
hideOnMobile?: boolean;
|
hideOnMobile?: boolean;
|
||||||
openOnLeaveAttempt?: boolean;
|
openOnLeaveAttempt?: boolean;
|
||||||
|
fullScreen?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PopupWidgetParams = PopupWidgetComponentProps;
|
export type PopupWidgetParams = PopupWidgetComponentProps;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@frontend/squzanswerer",
|
"name": "@frontend/squzanswerer",
|
||||||
"version": "1.0.43",
|
"version": "1.0.44",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist-package/index.js",
|
"main": "./dist-package/index.js",
|
||||||
"module": "./dist-package/index.js",
|
"module": "./dist-package/index.js",
|
||||||
|
@ -30,6 +30,7 @@ export default function QuizBanner({
|
|||||||
pulsation = false,
|
pulsation = false,
|
||||||
autoShowWidgetTime = 0,
|
autoShowWidgetTime = 0,
|
||||||
dialogDimensions,
|
dialogDimensions,
|
||||||
|
fullScreen = false,
|
||||||
}: BannerWidgetComponentProps) {
|
}: BannerWidgetComponentProps) {
|
||||||
const isMobile = useMediaQuery("(max-width: 600px)");
|
const isMobile = useMediaQuery("(max-width: 600px)");
|
||||||
const [isQuizShown, setIsQuizShown] = useState<boolean>(false);
|
const [isQuizShown, setIsQuizShown] = useState<boolean>(false);
|
||||||
@ -189,10 +190,18 @@ export default function QuizBanner({
|
|||||||
quizId={quizId}
|
quizId={quizId}
|
||||||
onClose={() => setIsQuizShown(false)}
|
onClose={() => setIsQuizShown(false)}
|
||||||
disableScrollLock
|
disableScrollLock
|
||||||
paperSx={{
|
paperSx={[
|
||||||
width: dialogDimensions?.width,
|
(isMobile || fullScreen) ? {
|
||||||
height: dialogDimensions?.height,
|
width: "100%",
|
||||||
}}
|
height: "100%",
|
||||||
|
maxHeight: "100%",
|
||||||
|
borderRadius: 0,
|
||||||
|
m: 0,
|
||||||
|
} : {
|
||||||
|
width: dialogDimensions?.width,
|
||||||
|
height: dialogDimensions?.height,
|
||||||
|
},
|
||||||
|
]}
|
||||||
/>
|
/>
|
||||||
</ThemeProvider>,
|
</ThemeProvider>,
|
||||||
document.body
|
document.body
|
||||||
|
@ -20,6 +20,7 @@ export default function OpenQuizButton({
|
|||||||
buttonText = "Пройти квиз",
|
buttonText = "Пройти квиз",
|
||||||
buttonTextColor,
|
buttonTextColor,
|
||||||
buttonBackgroundColor,
|
buttonBackgroundColor,
|
||||||
|
fullScreen = false,
|
||||||
}: ButtonWidgetComponentProps) {
|
}: ButtonWidgetComponentProps) {
|
||||||
const isMobile = useMediaQuery("(max-width: 600px)");
|
const isMobile = useMediaQuery("(max-width: 600px)");
|
||||||
const [isQuizShown, setIsQuizShown] = useState<boolean>(false);
|
const [isQuizShown, setIsQuizShown] = useState<boolean>(false);
|
||||||
@ -106,10 +107,18 @@ export default function OpenQuizButton({
|
|||||||
open={isQuizShown}
|
open={isQuizShown}
|
||||||
quizId={quizId}
|
quizId={quizId}
|
||||||
onClose={() => setIsQuizShown(false)}
|
onClose={() => setIsQuizShown(false)}
|
||||||
paperSx={{
|
paperSx={[
|
||||||
width: dialogDimensions?.width,
|
(isMobile || fullScreen) ? {
|
||||||
height: dialogDimensions?.height,
|
width: "100%",
|
||||||
}}
|
height: "100%",
|
||||||
|
maxHeight: "100%",
|
||||||
|
borderRadius: 0,
|
||||||
|
m: 0,
|
||||||
|
} : {
|
||||||
|
width: dialogDimensions?.width,
|
||||||
|
height: dialogDimensions?.height,
|
||||||
|
},
|
||||||
|
]}
|
||||||
/>
|
/>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
);
|
);
|
||||||
|
@ -5,15 +5,13 @@ import { useMediaQuery } from "@mui/material";
|
|||||||
import { PopupWidgetComponentProps } from "@/model/widget/popup";
|
import { PopupWidgetComponentProps } from "@/model/widget/popup";
|
||||||
|
|
||||||
|
|
||||||
const WIDGET_DEFAULT_WIDTH = "600px";
|
|
||||||
const WIDGET_DEFAULT_HEIGHT = "80%";
|
|
||||||
|
|
||||||
export default function QuizPopup({
|
export default function QuizPopup({
|
||||||
quizId,
|
quizId,
|
||||||
dialogDimensions,
|
dialogDimensions,
|
||||||
autoShowQuizTime = null,
|
autoShowQuizTime = null,
|
||||||
hideOnMobile = false,
|
hideOnMobile = false,
|
||||||
openOnLeaveAttempt = false,
|
openOnLeaveAttempt = false,
|
||||||
|
fullScreen = false,
|
||||||
}: PopupWidgetComponentProps) {
|
}: PopupWidgetComponentProps) {
|
||||||
const initialIsQuizShown = (autoShowQuizTime !== null || openOnLeaveAttempt) ? false : true;
|
const initialIsQuizShown = (autoShowQuizTime !== null || openOnLeaveAttempt) ? false : true;
|
||||||
|
|
||||||
@ -59,10 +57,18 @@ export default function QuizPopup({
|
|||||||
open={isQuizShown}
|
open={isQuizShown}
|
||||||
quizId={quizId}
|
quizId={quizId}
|
||||||
onClose={() => setIsQuizShown(false)}
|
onClose={() => setIsQuizShown(false)}
|
||||||
paperSx={{
|
paperSx={[
|
||||||
width: dialogDimensions?.width ?? WIDGET_DEFAULT_WIDTH,
|
(isMobile || fullScreen) ? {
|
||||||
height: dialogDimensions?.height ?? WIDGET_DEFAULT_HEIGHT,
|
width: "100%",
|
||||||
}}
|
height: "100%",
|
||||||
|
maxHeight: "100%",
|
||||||
|
borderRadius: 0,
|
||||||
|
m: 0,
|
||||||
|
} : {
|
||||||
|
width: dialogDimensions?.width,
|
||||||
|
height: dialogDimensions?.height,
|
||||||
|
},
|
||||||
|
]}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,12 @@ export default function QuizSideButton({
|
|||||||
{
|
{
|
||||||
m: 0,
|
m: 0,
|
||||||
},
|
},
|
||||||
!(isMobile || fullScreen) && {
|
(isMobile || fullScreen) ? {
|
||||||
|
width: "100%",
|
||||||
|
height: "100%",
|
||||||
|
maxHeight: "100%",
|
||||||
|
borderRadius: 0,
|
||||||
|
} : {
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
bottom: PADDING,
|
bottom: PADDING,
|
||||||
right: position === "right" ? PADDING : undefined,
|
right: position === "right" ? PADDING : undefined,
|
||||||
@ -74,13 +79,6 @@ export default function QuizSideButton({
|
|||||||
height: dialogDimensions?.height ?? WIDGET_DEFAULT_HEIGHT,
|
height: dialogDimensions?.height ?? WIDGET_DEFAULT_HEIGHT,
|
||||||
maxHeight: `calc(100% - ${PADDING * 2}px)`,
|
maxHeight: `calc(100% - ${PADDING * 2}px)`,
|
||||||
},
|
},
|
||||||
(isMobile || fullScreen) && {
|
|
||||||
position: "relative",
|
|
||||||
width: "100%",
|
|
||||||
height: "100%",
|
|
||||||
maxHeight: "100%",
|
|
||||||
borderRadius: 0,
|
|
||||||
},
|
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<Fade in={!isWidgetHidden} timeout={400}>
|
<Fade in={!isWidgetHidden} timeout={400}>
|
||||||
|
Loading…
Reference in New Issue
Block a user