Skip to content

Commit

Permalink
Add toLandingPageUrl to NotAuthorized
Browse files Browse the repository at this point in the history
  • Loading branch information
fhlavac committed Jul 6, 2023
1 parent 05bfb79 commit 54eba8c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/module/src/NotAuthorized/NotAuthorized.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface NotAuthorizedProps extends Omit<EmptyStateProps, 'children' | '
actions?: React.ReactNode;
/** Custom landing page button text */
toLandingPageText?: React.ReactNode;
toLandingPageUrl?: string;
}

const useStyles = createUseStyles({
Expand All @@ -35,6 +36,7 @@ const useStyles = createUseStyles({
export const NotAuthorized: React.FunctionComponent<NotAuthorizedProps> = ({
prevPageButtonText = 'Return to previous page',
toLandingPageText = 'Go to landing page',
toLandingPageUrl,
actions = null,
serviceName,
title = `You do not have access to ${serviceName}`,
Expand All @@ -60,7 +62,7 @@ export const NotAuthorized: React.FunctionComponent<NotAuthorizedProps> = ({
{prevPageButtonText}
</Button>
) : (
<Button variant="primary" component="a" href=".">
<Button variant="primary" component="a" href={ toLandingPageUrl ?? "." }>
{toLandingPageText}
</Button>
))}
Expand Down

0 comments on commit 54eba8c

Please sign in to comment.