mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-19 19:21:15 -05:00
Fixed mobile view for link survey
This commit is contained in:
@@ -78,9 +78,9 @@ export const LinkSurveyWrapper = ({
|
||||
surveyType={surveyType}
|
||||
styling={styling}
|
||||
onBackgroundLoaded={handleBackgroundLoaded}>
|
||||
<div className="flex max-h-dvh min-h-dvh items-end justify-center overflow-clip pt-[16dvh] md:items-start">
|
||||
<div className="flex max-h-dvh min-h-dvh items-center justify-center overflow-clip md:items-start md:pt-[16dvh]">
|
||||
{!styling.isLogoHidden && project.logo?.url && <ClientLogo projectLogo={project.logo} />}
|
||||
<div className="h-full w-full max-w-4xl space-y-6 md:px-1.5">
|
||||
<div className="h-full w-full max-w-4xl space-y-6 px-1.5">
|
||||
{isPreview && (
|
||||
<div className="fixed left-0 top-0 flex w-full items-center justify-between bg-slate-600 p-2 px-4 text-center text-sm text-white shadow-sm">
|
||||
<div />
|
||||
|
||||
@@ -166,6 +166,7 @@ export const MediaBackground: React.FC<MediaBackgroundProps> = ({
|
||||
return (
|
||||
<div
|
||||
ref={ContentRef}
|
||||
id="mobile-preview"
|
||||
className={`relative h-[90%] max-h-[42rem] w-[22rem] overflow-hidden rounded-[3rem] border-[6px] border-slate-400 ${getFilterStyle()}`}>
|
||||
{/* below element is use to create notch for the mobile device mockup */}
|
||||
<div className="absolute left-1/2 right-1/2 top-2 z-20 h-4 w-1/3 -translate-x-1/2 transform rounded-full bg-slate-400"></div>
|
||||
|
||||
@@ -23,10 +23,10 @@ export function RenderSurvey(props: SurveyContainerProps) {
|
||||
// Define survey type-specific styles
|
||||
const surveyTypeStyles =
|
||||
props.survey.type === "link"
|
||||
? {
|
||||
"--fb-survey-card-max-height": "60dvh",
|
||||
"--fb-survey-card-min-height": isDesktop ? `0dvh` : "60dvh",
|
||||
}
|
||||
? ({
|
||||
"--fb-survey-card-max-height": isDesktop ? "56dvh" : "33dvh",
|
||||
"--fb-survey-card-min-height": isDesktop ? `0dvh` : "33dvh",
|
||||
} as React.CSSProperties)
|
||||
: ({
|
||||
"--fb-survey-card-max-height": "25dvh",
|
||||
"--fb-survey-card-min-height": "25dvh",
|
||||
|
||||
@@ -11,6 +11,7 @@ export function ScrollableContainer({ children }: Readonly<ScrollableContainerPr
|
||||
const [isAtTop, setIsAtTop] = useState(false);
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const isSurveyPreview = Boolean(document.getElementById("survey-preview"));
|
||||
const isMobilePreview = isSurveyPreview ? Boolean(document.getElementById("mobile-preview")) : false;
|
||||
const previewScaleCoifficient = isSurveyPreview ? 0.66 : 1;
|
||||
|
||||
const checkScroll = () => {
|
||||
@@ -49,8 +50,12 @@ export function ScrollableContainer({ children }: Readonly<ScrollableContainerPr
|
||||
ref={containerRef}
|
||||
style={{
|
||||
scrollbarGutter: "stable both-edges",
|
||||
maxHeight: `calc(var(--fb-survey-card-max-height, 42dvh) * ${previewScaleCoifficient})`,
|
||||
minHeight: `calc(var(--fb-survey-card-min-height, 42dvh) * ${previewScaleCoifficient})`,
|
||||
maxHeight: isMobilePreview
|
||||
? "25dvh"
|
||||
: `calc(var(--fb-survey-card-max-height, 42dvh) * ${previewScaleCoifficient})`,
|
||||
minHeight: isMobilePreview
|
||||
? "25dvh"
|
||||
: `calc(var(--fb-survey-card-min-height, 42dvh) * ${previewScaleCoifficient})`,
|
||||
}}
|
||||
className={cn("fb-overflow-auto fb-px-4 fb-pb-4 fb-bg-survey-bg")}>
|
||||
{children}
|
||||
|
||||
Reference in New Issue
Block a user