-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DevOverlay] Floating Header and Bottom Stacks (#74581)
This PR moved existing pagination and version info to a floating header above the overlay. Moved the Bottom Stacks inside the dialog component and modified position as well. ![CleanShot 2025-01-07 at 20 31 24](https://github.com/user-attachments/assets/5da08731-5bdc-4978-89e8-a258744cdfa7) Closes NDX-634
- Loading branch information
1 parent
d2c45d0
commit 67c3d7a
Showing
5 changed files
with
129 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...components/Errors/error-overlay-floating-header/error-overlay-floating-header.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<typeof ErrorOverlayFloatingHeader> = { | ||
title: 'ErrorOverlayFloatingHeader', | ||
component: ErrorOverlayFloatingHeader, | ||
parameters: { | ||
layout: 'fullscreen', | ||
}, | ||
decorators: [withShadowPortal], | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<typeof ErrorOverlayFloatingHeader> | ||
|
||
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', | ||
}, | ||
}, | ||
} |
58 changes: 58 additions & 0 deletions
58
...nternal/components/Errors/error-overlay-floating-header/error-overlay-floating-header.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<div className="error-overlay-floating-header"> | ||
{/* TODO: better passing data instead of nullish coalescing */} | ||
<ErrorPagination | ||
readyErrors={readyErrors ?? []} | ||
activeIdx={activeIdx ?? 0} | ||
onActiveIndexChange={setActiveIndex ?? (() => {})} | ||
/> | ||
<VersionStalenessInfo versionInfo={versionInfo} /> | ||
</div> | ||
) | ||
} | ||
|
||
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; | ||
} | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters