diff --git a/packages/module/patternfly-docs/content/extensions/component-groups/examples/NotAuthorized/NotAuthorized.md b/packages/module/patternfly-docs/content/extensions/component-groups/examples/NotAuthorized/NotAuthorized.md new file mode 100644 index 00000000..2ce05972 --- /dev/null +++ b/packages/module/patternfly-docs/content/extensions/component-groups/examples/NotAuthorized/NotAuthorized.md @@ -0,0 +1,17 @@ +--- +section: extensions +subsection: Component groups +id: NotAuthorized +source: react +propComponents: ['NotAuthorized'] +--- + +import { NotAuthorized } from "@patternfly/react-component-groups"; + +## Components Usage + +### NotAuthorized Component + +```js file="./NotAuthorizedExample.tsx" + +``` diff --git a/packages/module/patternfly-docs/content/extensions/component-groups/examples/NotAuthorized/NotAuthorizedExample.tsx b/packages/module/patternfly-docs/content/extensions/component-groups/examples/NotAuthorized/NotAuthorizedExample.tsx new file mode 100644 index 00000000..e5d84741 --- /dev/null +++ b/packages/module/patternfly-docs/content/extensions/component-groups/examples/NotAuthorized/NotAuthorizedExample.tsx @@ -0,0 +1,23 @@ +import React from 'react'; +import { NotAuthorized } from '@patternfly/react-component-groups'; +import { Button } from '@patternfly/react-core'; + +export const BasicExample: React.FunctionComponent = () => { + const actions = [ + , + , + ]; + return ( + + ); +} diff --git a/packages/module/src/NotAuthorized/NotAuthorized.tsx b/packages/module/src/NotAuthorized/NotAuthorized.tsx index 3267b6db..1027732c 100644 --- a/packages/module/src/NotAuthorized/NotAuthorized.tsx +++ b/packages/module/src/NotAuthorized/NotAuthorized.tsx @@ -5,8 +5,7 @@ import { createUseStyles } from 'react-jss'; export interface NotAuthorizedProps extends Omit { serviceName?: string; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - icon?: React.ComponentType; + icon?: React.ComponentType; description?: React.ReactNode; showReturnButton?: boolean; className?: string; @@ -16,12 +15,6 @@ export interface NotAuthorizedProps extends Omit ( - - Contact your organization administrator(s) for more information or visit  - My User Access  to learn more about your permissions. - -); const useStyles = createUseStyles({ title: { @@ -31,26 +24,25 @@ const useStyles = createUseStyles({ }, }) -const NotAuthorized: React.FunctionComponent = ({ +export const NotAuthorized: React.FunctionComponent = ({ prevPageButtonText = 'Return to previous page', toLandingPageText = 'Go to landing page', - title, actions = null, serviceName, + title = `You do not have access to ${serviceName}`, icon: Icon = LockIcon, - description = , + description = 'Contact your system administrator(s) for more information.', showReturnButton = true, className, ...props -}) => { +}: NotAuthorizedProps) => { const classes = useStyles(); - const heading = title || `You do not have access to ${serviceName}`; return ( - {heading} + {title} {description} {actions} diff --git a/packages/module/src/NotAuthorized/__tests__/__snapshots__/NotAuthorized.test.js.snap b/packages/module/src/NotAuthorized/__tests__/__snapshots__/NotAuthorized.test.js.snap index 4edc42c4..dfc40939 100644 --- a/packages/module/src/NotAuthorized/__tests__/__snapshots__/NotAuthorized.test.js.snap +++ b/packages/module/src/NotAuthorized/__tests__/__snapshots__/NotAuthorized.test.js.snap @@ -16,7 +16,7 @@ exports[`NotAuthorized component should apply custom styles 1`] = ` You do not have access to Foo - + Contact your system administrator(s) for more information.