-
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 message (#74541)
This PR separated the error message component. ### Light ![CleanShot 2025-01-06 at 18 20 31](https://github.com/user-attachments/assets/3379bf69-743c-4431-8e03-e051be7f30e2) ### Dark ![CleanShot 2025-01-06 at 18 21 47](https://github.com/user-attachments/assets/d70309c5-df35-4f32-82a6-e9776976c632) Closes NDX-608
- Loading branch information
1 parent
c94fdef
commit 18ee367
Showing
6 changed files
with
90 additions
and
27 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
46 changes: 46 additions & 0 deletions
46
...-overlay/_experimental/internal/components/Errors/error-message/error-message.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,46 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import { ErrorMessage } from './error-message' | ||
import { withShadowPortal } from '../../../storybook/with-shadow-portal' | ||
|
||
const meta: Meta<typeof ErrorMessage> = { | ||
title: 'ErrorMessage', | ||
component: ErrorMessage, | ||
parameters: { | ||
layout: 'fullscreen', | ||
}, | ||
decorators: [withShadowPortal], | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<typeof ErrorMessage> | ||
|
||
export const ShortString: Story = { | ||
args: { | ||
errorMessage: 'A simple error message', | ||
}, | ||
} | ||
|
||
export const LongString: Story = { | ||
args: { | ||
errorMessage: ` | ||
Lorem ipsum dolor sit amet consectetur. | ||
Aliquet nulla ut fames eu posuere leo. | ||
Sed dolor lacus sit risus diam aliquam augue. | ||
Amet dictum donec scelerisque morbi aliquam volutpat. | ||
Sit nec sit faucibus elit id ultrices est. | ||
Nunc elementum fames at mattis nisi. | ||
Quisque lectus nec ultrices morbi aliquam vestibulum. | ||
Tempor quis volutpat urna proin. | ||
`, | ||
}, | ||
} | ||
|
||
export const ReactNode: Story = { | ||
args: { | ||
errorMessage: ( | ||
<span> | ||
An error message with <strong>formatted</strong> content | ||
</span> | ||
), | ||
}, | ||
} |
29 changes: 29 additions & 0 deletions
29
...eact-dev-overlay/_experimental/internal/components/Errors/error-message/error-message.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,29 @@ | ||
import { noop as css } from '../../../helpers/noop-template' | ||
|
||
export type ErrorMessageType = React.ReactNode | ||
|
||
type ErrorMessageProps = { | ||
errorMessage: ErrorMessageType | ||
} | ||
|
||
export function ErrorMessage({ errorMessage }: ErrorMessageProps) { | ||
return ( | ||
<p | ||
id="nextjs__container_errors_desc" | ||
className="nextjs__container_errors_desc" | ||
> | ||
{errorMessage} | ||
</p> | ||
) | ||
} | ||
|
||
export const styles = css` | ||
.nextjs__container_errors_desc { | ||
color: var(--color-red-900); | ||
font-weight: 500; | ||
font-size: var(--size-font); | ||
letter-spacing: -0.32px; | ||
line-height: var(--size-6); | ||
white-space: pre-wrap; | ||
} | ||
` |
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
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