-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DevOverlay] Add error type label (#74543)
This PR added the error type label. ### Light ![CleanShot 2025-01-06 at 19 08 56](https://github.com/user-attachments/assets/1e85d19e-b989-4e1a-914d-567abfb309d2) ### Dark ![CleanShot 2025-01-06 at 19 08 50](https://github.com/user-attachments/assets/c5d2e6a6-f43e-4134-b1b7-0dc13eb83cd4) Closes NDX-607
- Loading branch information
1 parent
18ee367
commit 571aafe
Showing
4 changed files
with
91 additions
and
20 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
45 changes: 45 additions & 0 deletions
45
...ay/_experimental/internal/components/Errors/error-type-label/error-type-label.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 { ErrorTypeLabel } from './error-type-label' | ||
import { withShadowPortal } from '../../../storybook/with-shadow-portal' | ||
|
||
const meta: Meta<typeof ErrorTypeLabel> = { | ||
title: 'ErrorTypeLabel', | ||
component: ErrorTypeLabel, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
decorators: [withShadowPortal], | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<typeof ErrorTypeLabel> | ||
|
||
export const BuildError: Story = { | ||
args: { | ||
errorType: 'Build Error', | ||
}, | ||
} | ||
|
||
export const RuntimeError: Story = { | ||
args: { | ||
errorType: 'Runtime Error', | ||
}, | ||
} | ||
|
||
export const ConsoleError: Story = { | ||
args: { | ||
errorType: 'Console Error', | ||
}, | ||
} | ||
|
||
export const UnhandledRuntimeError: Story = { | ||
args: { | ||
errorType: 'Unhandled Runtime Error', | ||
}, | ||
} | ||
|
||
export const MissingRequiredHTMLTag: Story = { | ||
args: { | ||
errorType: 'Missing Required HTML Tag', | ||
}, | ||
} |
37 changes: 37 additions & 0 deletions
37
...ev-overlay/_experimental/internal/components/Errors/error-type-label/error-type-label.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,37 @@ | ||
import { noop as css } from '../../../helpers/noop-template' | ||
|
||
export type ErrorType = | ||
| 'Build Error' | ||
| 'Runtime Error' | ||
| 'Console Error' | ||
| 'Unhandled Runtime Error' | ||
| 'Missing Required HTML Tag' | ||
|
||
type ErrorTypeLabelProps = { | ||
errorType: ErrorType | ||
} | ||
|
||
export function ErrorTypeLabel({ errorType }: ErrorTypeLabelProps) { | ||
return ( | ||
<h1 | ||
id="nextjs__container_errors_label" | ||
className="nextjs__container_errors_label" | ||
> | ||
{errorType} | ||
</h1> | ||
) | ||
} | ||
|
||
export const styles = css` | ||
.nextjs__container_errors_label { | ||
padding: var(--size-1_5); | ||
margin: var(--size-gap-double) 0; | ||
border-radius: var(--rounded-lg); | ||
background: var(--color-red-100); | ||
font-weight: 600; | ||
font-size: var(--size-3); | ||
color: var(--color-red-900); | ||
font-family: var(--font-stack-monospace); | ||
line-height: var(--size-5); | ||
} | ||
` |
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