Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEV-2023] fix empty area on top of solutions #1281

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eight-lizards-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nextjs-website": patch
---

Fix empty space on top of Solution page
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const Page = async ({ params }: { params: Params }) => {
<>
{structuredData}
<GitBookTemplate
hasHeader={false}
menuName={props.solution.title}
breadcrumbs={[
...pageToBreadcrumbs('solutions', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ import { useScrollUp } from '../ProductHeader/useScrollUp';
import GuideMenuItems, { type GuideMenuItemsProps } from './Menu';
import { useTranslations } from 'next-intl';

type GuideMenuProps = GuideMenuItemsProps & { distanceFromTop?: number };
type GuideMenuProps = GuideMenuItemsProps & {
distanceFromTop?: number;
hasHeader: boolean;
};

const GuideMenu = (menuProps: GuideMenuProps) => {
const [open, setOpen] = useState(false);
Expand All @@ -36,6 +39,14 @@ const GuideMenu = (menuProps: GuideMenuProps) => {

const height = `calc(100vh - ${top}px)`;

const topStyle = menuProps.hasHeader
? { xs: top + 62, sm: top + 90, md: top + 77 }
: {
xs: top,
sm: top,
md: top,
};

const handleClick = useCallback(() => {
setOpen((prev) => !prev);
}, []);
Expand All @@ -61,7 +72,7 @@ const GuideMenu = (menuProps: GuideMenuProps) => {
backgroundColor: palette.grey[50],
flexShrink: 0,
position: 'sticky',
top: { xs: top + 62, sm: top + 90, md: top + 77 },
top: topStyle,
height: { lg: height },
overflowY: 'auto',
transition: 'all 0.5s linear',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type GitBookTemplateProps = {
contentMarginTop?: number;
versions?: GuideMenuItemsProps['versions'];
versionName?: GuideMenuItemsProps['versionName'];
hasHeader?: boolean;
} & Pick<
ProductGuidePageProps,
'menu' | 'body' | 'bodyConfig' | 'path' | 'pathPrefix'
Expand All @@ -34,7 +35,9 @@ const GitBookTemplate = ({
breadcrumbs,
menuDistanceFromTop,
contentMarginTop = 75,
hasHeader = true,
}: GitBookTemplateProps) => {
const headerPadding = hasHeader ? '60px' : '-80px';
MarBert marked this conversation as resolved.
Show resolved Hide resolved
return (
<FragmentProvider>
<Box
Expand All @@ -47,6 +50,7 @@ const GitBookTemplate = ({
>
{menu && (
<GuideMenu
hasHeader={hasHeader}
menu={menu}
assetsPrefix={bodyConfig.assetsPrefix}
linkPrefix={pathPrefix}
Expand All @@ -67,7 +71,7 @@ const GitBookTemplate = ({
},
}}
>
<Box sx={{ paddingTop: '60px', paddingX: '40px' }}>
<Box sx={{ paddingTop: headerPadding, paddingX: '40px' }}>
MarBert marked this conversation as resolved.
Show resolved Hide resolved
<ProductBreadcrumbs breadcrumbs={breadcrumbs} />
</Box>
<Box sx={{ padding: '32px 40px' }}>
Expand All @@ -78,15 +82,15 @@ const GitBookTemplate = ({
sx={{
display: { xs: 'none', lg: 'initial' },
position: 'relative',
padding: { lg: '80px 64px' },
padding: { lg: hasHeader ? '80px 64px' : '48px 64px' },
width: { lg: '378px' },
}}
>
<Box
sx={{
position: 'sticky',
maxWidth: '378px',
top: 144,
top: hasHeader ? 144 : 64,
}}
>
<GuideInPageMenu
Expand Down
Loading