[WEB-4964] fix: update onboarding layout and enhance scroll behavior (#7825)

* [WEB-4964] fix: update onboarding layout and enhance scroll behavior
This commit is contained in:
Prateek Shourya 2025-09-18 18:26:06 +05:30 committed by GitHub
parent 365d2d902c
commit 68d72daa90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 5 deletions

View File

@ -132,7 +132,7 @@ export const OnboardingRoot: FC<Props> = observer(({ invitations = [] }) => {
}, []);
return (
<>
<div className="flex flex-col h-full">
{/* Header with progress */}
<OnboardingHeader
currentStep={currentStep}
@ -142,6 +142,6 @@ export const OnboardingRoot: FC<Props> = observer(({ invitations = [] }) => {
{/* Main content area */}
<OnboardingStepRoot currentStep={currentStep} invitations={invitations} handleStepChange={handleStepChange} />
</>
</div>
);
});

View File

@ -1,6 +1,6 @@
"use client";
import { FC, useMemo } from "react";
import { FC, useEffect, useMemo, useRef } from "react";
// plane imports
import { EOnboardingSteps, IWorkspaceMemberInvitation } from "@plane/types";
// local components
@ -18,6 +18,19 @@ type Props = {
export const OnboardingStepRoot: FC<Props> = (props) => {
const { currentStep, invitations, handleStepChange } = props;
// ref for the scrollable container
const scrollContainerRef = useRef<HTMLDivElement>(null);
// scroll to top when step changes
useEffect(() => {
if (scrollContainerRef.current) {
scrollContainerRef.current.scrollTo({
top: 0,
behavior: "smooth",
});
}
}, [currentStep]);
// memoized step component mapping
const stepComponents = useMemo(
() => ({
@ -33,8 +46,10 @@ export const OnboardingStepRoot: FC<Props> = (props) => {
);
return (
<div className="flex-1 flex items-center justify-center p-8">
<div className="w-full max-w-[24rem]">{stepComponents[currentStep]} </div>
<div ref={scrollContainerRef} className="flex-1 overflow-y-auto">
<div className="flex items-center justify-center min-h-full p-8">
<div className="w-full max-w-[24rem]">{stepComponents[currentStep]} </div>
</div>
</div>
);
};