Skip to content

Commit

Permalink
Expose default props
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcorner committed Feb 23, 2024
1 parent a7abdc0 commit 44db752
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 27 deletions.
30 changes: 3 additions & 27 deletions src/LoadErrorMessage/LoadErrorMessage.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,42 +39,18 @@ export const Default: Story = {

// HTTP 404
export const HTTP404: Story = {
args: {
...Default.args,
actionButtonText: "Go back",
contactTeam: "none",
image: "virto-shrugging",
message:
"We're unable to locate the page you requested. Please ensure the URL is correct or explore other areas of the site.",
title: "Sorry, the page doesn't exist!"
},
args: LoadErrorMessage.default404Props,
render: Template
};

// HTTP 401
export const HTTP401: Story = {
args: {
...Default.args,
actionButtonText: undefined,
contactTeam: "none",
message:
"Sorry, but you don't have access to view this page. Contact an admin to request access.",
title: "Access Denied!"
},
args: LoadErrorMessage.default401Props,
render: Template
};

// General Error
export const GeneralError: Story = {
args: {
...Default.args,
actionButtonText: "Refresh",
contactUrl: "https://support.virto.com",
errorDetails: "Invalid token - length is 0",
image: "virto-head-scratching",
message:
"Oops! Something went wrong on our end 😓 Our team is actively addressing it and working to resolve the issue. Please try again later.",
title: "Something is not right!"
},
args: LoadErrorMessage.defaultErrorProps,
render: Template
};
28 changes: 28 additions & 0 deletions src/LoadErrorMessage/LoadErrorMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,32 @@ const LoadErrorMessage = ({
);
};

LoadErrorMessage.default404Props = {
actionButtonText: "Go back",
contactTeam: "none",
image: "virto-shrugging",
message:
"We're unable to locate the page you requested. Please ensure the URL is correct or explore other areas of the site.",
title: "Sorry, the page doesn't exist!"
} as const;

LoadErrorMessage.default401Props = {
contactTeam: "none",
image: "virto-thinking",
message:
"Sorry, but you don't have access to view this page. Contact an admin to request access.",
title: "Access Denied!"
} as const;

LoadErrorMessage.defaultErrorProps = {
actionButtonText: "Refresh",
contactTeam: "Support",
contactUrl: "https://support.virto.com",
errorDetails: "Invalid token - length is 0",
image: "virto-head-scratching",
message:
"Oops! Something went wrong on our end 😓 Our team is actively addressing it and working to resolve the issue. Please try again later.",
title: "Something is not right!"
} as const;

export default LoadErrorMessage;

0 comments on commit 44db752

Please sign in to comment.