diff --git a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Dialog/styles.ts b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Dialog/styles.ts index 4d415022bdcd7..dda84603b42b2 100644 --- a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Dialog/styles.ts +++ b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Dialog/styles.ts @@ -13,7 +13,7 @@ const styles = css` border-radius: var(--rounded-xl); box-shadow: var(--shadow-md); max-height: calc(100% - 56px); - overflow-y: hidden; + position: relative; } @media (max-height: 812px) { diff --git a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Errors/error-overlay-bottom-stacks/error-overlay-bottom-stacks.tsx b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Errors/error-overlay-bottom-stacks/error-overlay-bottom-stacks.tsx index adf94c9fc4827..a8c422a07ccc0 100644 --- a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Errors/error-overlay-bottom-stacks/error-overlay-bottom-stacks.tsx +++ b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Errors/error-overlay-bottom-stacks/error-overlay-bottom-stacks.tsx @@ -37,9 +37,10 @@ export const styles = css` display: flex; flex-direction: column; width: 100%; - margin-right: auto; - margin-left: auto; outline: none; + position: absolute; + bottom: -10px; + z-index: -1; @media (min-width: 576px) { max-width: 540px; @@ -56,25 +57,26 @@ export const styles = css` .error-overlay-bottom-stack-1, .error-overlay-bottom-stack-2 { - padding: 0.75rem; + padding: 12px; align-self: center; border: 1px solid var(--color-gray-400); border-radius: var(--rounded-xl); - margin-top: -1rem; /* 16px */ box-shadow: var(--shadow-md); background: var(--color-background-200); animation: stack-slide-down 0.3s ease-out forwards; transform-origin: top center; + position: relative; } .error-overlay-bottom-stack-1 { - z-index: 49; - width: calc(100% - 1.5rem); /* 24px */ + width: calc(100% - 24px); } .error-overlay-bottom-stack-2 { - z-index: 48; - width: calc(100% - 3rem); /* 48px */ + z-index: -2; + position: absolute; + top: 10px; + width: calc(100% - 48px); } @keyframes stack-slide-down { diff --git a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Errors/error-overlay-floating-header/error-overlay-floating-header.stories.tsx b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Errors/error-overlay-floating-header/error-overlay-floating-header.stories.tsx new file mode 100644 index 0000000000000..4ace959d322e7 --- /dev/null +++ b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Errors/error-overlay-floating-header/error-overlay-floating-header.stories.tsx @@ -0,0 +1,45 @@ +import type { Meta, StoryObj } from '@storybook/react' +import { ErrorOverlayFloatingHeader } from './error-overlay-floating-header' +import { withShadowPortal } from '../../../storybook/with-shadow-portal' + +const meta: Meta = { + title: 'ErrorOverlayFloatingHeader', + component: ErrorOverlayFloatingHeader, + parameters: { + layout: 'fullscreen', + }, + decorators: [withShadowPortal], +} + +export default meta +type Story = StoryObj + +export const Default: Story = { + args: { + readyErrors: [ + { + id: 0, + runtime: true, + error: new Error('First error message'), + frames: [], + }, + { + id: 1, + runtime: true, + error: new Error('Second error message'), + frames: [], + }, + { + id: 2, + runtime: true, + error: new Error('Third error message'), + frames: [], + }, + ], + activeIdx: 1, + versionInfo: { + installed: '15.0.0', + staleness: 'stale-major', + }, + }, +} diff --git a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Errors/error-overlay-floating-header/error-overlay-floating-header.tsx b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Errors/error-overlay-floating-header/error-overlay-floating-header.tsx new file mode 100644 index 0000000000000..bc2e48f6411fc --- /dev/null +++ b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Errors/error-overlay-floating-header/error-overlay-floating-header.tsx @@ -0,0 +1,58 @@ +import type { ReadyRuntimeError } from '../../../helpers/get-error-by-type' +import type { VersionInfo } from '../../../../../../../../server/dev/parse-version-info' + +import { ErrorPagination } from '../ErrorPagination/ErrorPagination' +import { VersionStalenessInfo } from '../../VersionStalenessInfo' +import { noop as css } from '../../../helpers/noop-template' + +type ErrorOverlayFloatingHeaderProps = { + readyErrors?: ReadyRuntimeError[] + activeIdx?: number + setActiveIndex?: (index: number) => void + versionInfo?: VersionInfo +} + +export function ErrorOverlayFloatingHeader({ + readyErrors, + activeIdx, + setActiveIndex, + versionInfo, +}: ErrorOverlayFloatingHeaderProps) { + return ( +
+ {/* TODO: better passing data instead of nullish coalescing */} + {})} + /> + +
+ ) +} + +export const styles = css` + .error-overlay-floating-header { + display: flex; + justify-content: space-between; + align-items: center; + + width: 100%; + position: absolute; + transform: translateY(-32px); + + outline: none; + + @media (min-width: 576px) { + max-width: 540px; + } + + @media (min-width: 768px) { + max-width: 720px; + } + + @media (min-width: 992px) { + max-width: 960px; + } + } +` diff --git a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Errors/error-overlay-layout/error-overlay-layout.tsx b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Errors/error-overlay-layout/error-overlay-layout.tsx index 74e873b0264b7..f98eb700182b6 100644 --- a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Errors/error-overlay-layout/error-overlay-layout.tsx +++ b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/Errors/error-overlay-layout/error-overlay-layout.tsx @@ -12,12 +12,10 @@ import { DialogFooter, } from '../../Dialog' import { Overlay } from '../../Overlay' -import { ErrorPagination } from '../ErrorPagination/ErrorPagination' import { ErrorOverlayToolbar, styles as toolbarStyles, } from '../error-overlay-toolbar/error-overlay-toolbar' -import { VersionStalenessInfo } from '../../VersionStalenessInfo' import { ErrorOverlayBottomStacks } from '../error-overlay-bottom-stacks/error-overlay-bottom-stacks' import { ErrorOverlayFooter } from '../error-overlay-footer/error-overlay-footer' import { noop as css } from '../../../helpers/noop-template' @@ -29,6 +27,10 @@ import { ErrorTypeLabel, styles as errorTypeLabelStyles, } from '../error-type-label/error-type-label' +import { + ErrorOverlayFloatingHeader, + styles as floatingHeaderStyles, +} from '../error-overlay-floating-header/error-overlay-floating-header' type ErrorOverlayLayoutProps = { errorMessage: ErrorMessageType @@ -70,14 +72,14 @@ export function ErrorOverlayLayout({ aria-describedby="nextjs__container_errors_desc" onClose={onClose} > + - {/* TODO: better passing data instead of nullish coalescing */} - {})} - />
-
@@ -100,16 +101,17 @@ export function ErrorOverlayLayout({ />
+ - ) } export const styles = css` + ${floatingHeaderStyles} ${errorTypeLabelStyles} ${errorMessageStyles} ${toolbarStyles}