Skip to content
Open
Show file tree
Hide file tree
Changes from all 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/beige-cobras-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nextjs-website": minor
---

Change ProductHeader behaviour to be fixed on desktop and maintain the old behaviour on mobile
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,20 @@ const GuideMenu = (menuProps: GuideMenuProps) => {
const segments = currentPath.split('/');
const expanded = segments.map((_, i) => segments.slice(0, i + 1).join('/'));

const top = scrollUp ? SITE_HEADER_HEIGHT : 0;
const topOffsetXs = scrollUp ? SITE_HEADER_HEIGHT : 0;

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

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

const handleClick = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Product } from '@/lib/types/product';
import { Box, useTheme } from '@mui/material';
import { Header } from '@/editorialComponents/Header';
import React, { FC } from 'react';
import { useScrollUp } from '@/components/atoms/ProductHeader/useScrollUp';
import { SITE_HEADER_HEIGHT } from '@/components/molecules/SiteHeader/SiteHeader';
import { useTranslations } from 'next-intl';
import { useScrollUp } from './useScrollUp';

type ProductHeaderProps = {
product: Product;
Expand All @@ -29,7 +29,7 @@ const ProductHeader: FC<ProductHeaderProps> = ({ product, path }) => {
<Box
sx={{
position: 'fixed',
top: scrollUp ? SITE_HEADER_HEIGHT : 0,
top: { xs: scrollUp ? SITE_HEADER_HEIGHT : 0, md: SITE_HEADER_HEIGHT },
zIndex: scrollUp ? 90 : 250,
transition: 'top 0.5s linear',
width: '100vw',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ const SiteHeader = (
return (
<Box
sx={{
position: 'sticky',
position: 'fixed',
top: 0,
height: SITE_HEADER_HEIGHT,
zIndex: 100,
width: '100vw',
}}
>
<Stack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const ProductLayout: FC<LayoutPropsWithChildren> = ({
{structuredData}
{product && path && <ProductHeader product={product} path={path} />}
{product && showBreadcrumbs && (
<EContainer sx={{ marginTop: 10, paddingTop: 3 }}>
<EContainer sx={{ marginTop: 15, paddingTop: 3 }}>
<ProductBreadcrumbs
breadcrumbs={[...productPageToBreadcrumbs(product, paths)]}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,17 @@ const GitBookTemplate = ({
versions,
breadcrumbs,
menuDistanceFromTop,
contentMarginTop = 75,
contentMarginTop,
hasHeader = true,
hasInPageMenu = true,
}: GitBookTemplateProps) => {
const t = useTranslations();
const paddingTop = hasHeader ? '60px' : '-80px';
const responsiveContentMarginTop = (contentMarginTop &&
`${contentMarginTop}px`) || {
xs: '30px',
md: '110px',
};

return (
<FragmentProvider>
Expand All @@ -66,7 +71,7 @@ const GitBookTemplate = ({
)}
<Stack
sx={{
margin: `${contentMarginTop} auto`,
marginTop: responsiveContentMarginTop,
paddingTop: 3,
flexGrow: { lg: 1 },
maxWidth: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const TutorialTemplate = ({
// 80px is the height of the product header
marginTop: '80px',
marginX: 'auto',
paddingTop: 3,
paddingTop: 8,
px: { xs: 4, lg: 0 },
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const UseCaseTemplate = ({
>
{product && (
<Box
paddingY={'20px'}
paddingY={'74px'}
marginTop={{ sm: '64px', md: '76px' }}
style={{
backgroundColor: palette.grey[50],
Expand Down