1
+ import type { Meta , StoryObj } from "@storybook/react" ;
2
+ import { fn } from "@storybook/test" ;
3
+
4
+ import { ErrorPage as ErrorPageComponent } from "./index.jsx" ;
5
+
6
+ const meta = {
7
+ component : ErrorPageComponent ,
8
+ parameters : {
9
+ layout : "fullscreen" ,
10
+ } ,
11
+ argTypes : {
12
+ error : {
13
+ description : "The error object to display" ,
14
+ table : {
15
+ category : "Props" ,
16
+ } ,
17
+ } ,
18
+ reset : {
19
+ description : "Optional reset function" ,
20
+ table : {
21
+ category : "Props" ,
22
+ } ,
23
+ } ,
24
+ } ,
25
+ tags : [ "autodocs" ] ,
26
+ } satisfies Meta < typeof ErrorPageComponent > ;
27
+ export default meta ;
28
+
29
+ type Story = StoryObj < typeof ErrorPageComponent > ;
30
+
31
+ export const Default : Story = {
32
+ args : {
33
+ error : new Error ( "Something went wrong while loading the data" ) ,
34
+ } ,
35
+ } ;
36
+
37
+ export const WithReset : Story = {
38
+ args : {
39
+ error : new Error ( "Failed to fetch user profile" ) ,
40
+ reset : fn ( ) ,
41
+ } ,
42
+ } ;
43
+
44
+ export const WithDigest : Story = {
45
+ args : {
46
+ error : Object . assign ( new Error ( "Internal server error" ) , {
47
+ digest : "ERR_500_INTERNAL" ,
48
+ } ) ,
49
+ reset : fn ( ) ,
50
+ } ,
51
+ } ;
52
+
53
+ export const NetworkError : Story = {
54
+ args : {
55
+ error : new Error ( "NetworkError: Failed to fetch" ) ,
56
+ reset : fn ( ) ,
57
+ } ,
58
+ } ;
59
+
60
+ export const ValidationError : Story = {
61
+ args : {
62
+ error : Object . assign ( new Error ( "Validation failed" ) , {
63
+ digest : "VALIDATION_ERROR_422" ,
64
+ } ) ,
65
+ } ,
66
+ } ;
67
+
68
+ export const LongErrorMessage : Story = {
69
+ args : {
70
+ error : new Error (
71
+ "Failed to process the request due to an unexpected error in the authentication module. Please check your credentials and try again. If the problem persists, contact support." ,
72
+ ) ,
73
+ reset : fn ( ) ,
74
+ } ,
75
+ } ;
0 commit comments