Skip to content

Commit a26fe16

Browse files
Merge branch 'patternfly:main' into main
2 parents 8cdaa3e + cccf6f9 commit a26fe16

File tree

12 files changed

+108
-114
lines changed

12 files changed

+108
-114
lines changed

packages/module/patternfly-docs/content/extensions/component-groups/about-component-groups.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The component groups extension contains a range of React components that are mor
1313

1414
The creation and maintenance of this extension is a collaborative effort between the PatternFly and Red Hat Hybrid Cloud Console teams. All component groups receive accessibility and design reviews, and we are working to improve internationalization, add unit test coverage, and ensure that CSS overrides all correctly reference the PatternFly CSS API.
1515

16-
**Note:** This extension replaces [`RedHatInsights/frontend-components`](https://github.com/RedHatInsights/frontend-components). If you previoulsy used `frontend-components`, you can refer to [this migration guide](https://github.com/patternfly/react-component-groups/migration.md) to help you transition to `react-component-groups`.
16+
**Note:** This extension replaces [`RedHatInsights/frontend-components`](https://github.com/RedHatInsights/frontend-components). If you previoulsy used `frontend-components`, you can refer to [this migration guide](https://github.com/patternfly/react-component-groups/blob/main/migration.md) to help you transition to `react-component-groups`.
1717

1818
## Contribution guidelines
1919

packages/module/patternfly-docs/content/extensions/component-groups/examples/CloseButton/CloseButton.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ propComponents: ['CloseButton']
1616
import { CloseIcon } from '@patternfly/react-icons';
1717
import CloseButton from '@patternfly/react-component-groups/dist/dynamic/CloseButton';
1818

19-
**Close button**
19+
The **close button** component provides a way for users to exit a modal, dialogue, or similar action. To further customize this component, you can also utilize all properties of the [button component](/components/button).
2020

21-
The close button component provides a way for users to exit a modal, dialogue, or similar action.
21+
## Examples
2222

23-
## Examples ##
23+
### Basic close button
2424

25-
You can use onClick to execute a callback when a user selects the close button.
25+
You can use `onClick` to execute a callback when a user clicks the close button.
2626

2727
```js file="./CloseButtonExample.tsx"
2828

packages/module/patternfly-docs/content/extensions/component-groups/examples/CloseButton/CloseButtonExample.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import CloseButton from '@patternfly/react-component-groups/dist/dynamic/CloseBu
44

55
export const BasicExample: React.FunctionComponent = () => (
66
<>
7-
<CloseButton onClick={()=>{console.log('Close button clicked')}} />
7+
<CloseButton onClick={()=>{console.log('Close button clicked')}} style={{ float: 'none' }} />
88
</>
99
);

packages/module/patternfly-docs/content/extensions/component-groups/examples/ErrorState/ErrorState.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ sourceLink: https://github.com/patternfly/react-component-groups/blob/main/packa
1616

1717
import ErrorState from "@patternfly/react-component-groups/dist/dynamic/ErrorState";
1818

19-
The **error state** component repurposes the `EmptyState` component to display an error to users.
19+
The **error state** component repurposes the `EmptyState` component to display an error to users. To further customize this component, you can also utilize all properties of the [empty state component](/components/empty-state), with the `exception` of `children`.
2020

2121
## Examples
2222

@@ -30,7 +30,7 @@ To provide users with error details, a basic error state should contain an appro
3030

3131
### Custom footer
3232

33-
To override default action button, specify your own using `customFooter`.
33+
To override the default action button, specify your own using `customFooter`.
3434

3535
```js file="./ErrorStateFooterExample.tsx"
3636

packages/module/patternfly-docs/content/extensions/component-groups/examples/NotAuthorized/NotAuthorized.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@ A **not authorized** component displays an error screen to users when they attem
1717

1818
A basic not authorized component displays a title, a description, and custom actions.
1919

20-
You can customize the not authorized component to fit your use case by specifying the `serviceName` to appear in the title, the `description` to provide appropriate context for the error, and the `actions` that a user can take instead.
20+
```js file="./NotAuthorizedDefaultExample.tsx"
2121

22-
```js file="./NotAuthorizedExample.tsx"
22+
```
23+
24+
### Not authorized with custom actions
25+
26+
You can customize the not authorized component to fit your use case by specifying the `serviceName` to appear in the title, a `description` of appropriate context for the error, and the `actions` that a user can take instead.
27+
28+
```js file="./NotAuthorizedCustomExample.tsx"
2329

2430
```
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import NotAuthorized from "@patternfly/react-component-groups/dist/dynamic/NotAu
55
export const BasicExample: React.FunctionComponent = () => {
66
const primaryAction =
77
<Button key="1">
8-
First action
8+
Custom primary action
99
</Button>;
1010
const secondaryActions = [
1111
<Button key="2" variant="link">
@@ -19,7 +19,6 @@ export const BasicExample: React.FunctionComponent = () => {
1919
<NotAuthorized
2020
primaryAction={primaryAction}
2121
secondaryActions={secondaryActions}
22-
className="something"
2322
description="Description text"
2423
serviceName="Demo bundle"
2524
prevPageButtonText="Go to previous page"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
import NotAuthorized from "@patternfly/react-component-groups/dist/dynamic/NotAuthorized";
3+
4+
export const BasicExample: React.FunctionComponent = () => (
5+
<NotAuthorized
6+
description="Description text"
7+
serviceName="Demo bundle"
8+
prevPageButtonText="Go to previous page"
9+
/>
10+
);
11+

packages/module/patternfly-docs/content/extensions/component-groups/examples/WarningModal/WarningModal.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,26 @@ A **warning modal** component displays a modal when a user tries to perform a ri
2424

2525
A basic warning modal is triggered when a user tries to perform an action that is deemed risky.
2626

27-
You can customize the contents of the modal to fit your use cases. To adjust the text in the modal, pass your desired title to `title` and your message to the `<WarningModal>` component. To customize the action buttons in the modal, use `onConfirm` and `onClose`.
27+
You can customize the contents of the modal to fit your use cases. To adjust the text in the modal, pass your desired title to `title` and your message to the `<WarningModal>` component. To customize the action buttons in the modal, use `onConfirm` and `onClose`.
28+
29+
For further customization, you can utilize all properties of the [modal component](/components/modal), with the exception of `ref`.
2830

2931
```js file="./WarningModalExample.tsx"
3032

3133
```
3234

33-
### Warning Modal with danger button variant
35+
### Warning modal with a custom button variant
3436

35-
You can customize the modal to have a confirm button with a danger color
37+
You can apply custom variant to a warning modal's confirmation button.
3638

3739
```js file="./WarningModalDangerExample.tsx"
3840

3941
```
4042

4143

42-
### Warning Modal with checkbox
44+
### Warning modal with a checkbox
4345

44-
You can customize the Warning Modal to include a checkbox to double check the user wants to use the selected action.
46+
To confirm that a user wishes to initiate a selected action, you can add a checkbox to a warning modal.
4547

4648
```js file="./WarningModalCheckboxExample.tsx"
4749

packages/module/src/CloseButton/CloseButton.tsx

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,32 @@
11
import React from 'react';
22
import { Button, ButtonProps, ButtonVariant } from '@patternfly/react-core';
33
import { CloseIcon } from '@patternfly/react-icons';
4-
import clsx from 'clsx';
54
import { createUseStyles } from 'react-jss';
5+
import clsx from 'clsx';
66

77
const useStyles = createUseStyles({
8-
'& float-right': {
9-
float: 'right'
8+
closeButton: {
9+
float: 'inline-end',
10+
padding: '10px 14px'
1011
},
11-
'& no-padding': {
12-
padding: 0
13-
}
1412
});
1513

1614
export interface CloseButtonProps extends ButtonProps {
17-
/** Additional styling to apply to the close button. */
18-
additionalClassName?: string;
19-
/** Aria label for accessibility */
20-
ariaLabel?: string;
21-
/** Data test id used for testing. */
15+
/** Data test ID used for testing. */
2216
dataTestID?: string;
23-
/** Callback when the button is clicked*/
24-
onClick: (event: any) => void;
25-
}
17+
};
2618

2719
const CloseButton: React.FunctionComponent<CloseButtonProps> = ({
28-
additionalClassName,
29-
ariaLabel,
20+
className,
3021
dataTestID,
3122
onClick,
3223
...props
3324
}: CloseButtonProps) => {
3425
const classes = useStyles();
3526
return (
3627
<Button
37-
aria-label={ariaLabel || 'Close'}
38-
className={clsx(classes, additionalClassName)}
28+
aria-label={props['aria-label'] || 'Close'}
29+
className={clsx(classes.closeButton, className)}
3930
data-test-id={dataTestID}
4031
onClick={onClick}
4132
variant={ButtonVariant.plain}

packages/module/src/NotAuthorized/NotAuthorized.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Button, EmptyState, EmptyStateBody, EmptyStateIcon, EmptyStateProps, EmptyStateVariant, EmptyStateHeader, EmptyStateFooter, EmptyStateActions, } from '@patternfly/react-core';
2+
import { Button, EmptyState, EmptyStateBody, EmptyStateIcon, EmptyStateProps, EmptyStateVariant, EmptyStateHeader, EmptyStateFooter, EmptyStateActions, ButtonVariant, } from '@patternfly/react-core';
33
import { LockIcon } from '@patternfly/react-icons';
44

55
export interface NotAuthorizedProps extends Omit<EmptyStateProps, 'children' | 'title'> {
@@ -46,18 +46,18 @@ const NotAuthorized: React.FunctionComponent<NotAuthorizedProps> = ({
4646
<EmptyStateBody>{description}</EmptyStateBody>
4747
<EmptyStateFooter>
4848
{primaryAction ? <EmptyStateActions>{primaryAction}</EmptyStateActions> : null}
49-
<EmptyStateActions>
50-
{secondaryActions ? <EmptyStateActions>{secondaryActions}</EmptyStateActions> : null}
51-
{showReturnButton &&
49+
{showReturnButton && !primaryAction &&
5250
(document.referrer ? (
53-
<Button variant="link" onClick={() => history.back()}>
51+
<Button variant={ButtonVariant.primary} onClick={() => history.back()}>
5452
{prevPageButtonText}
5553
</Button>
5654
) : (
57-
<Button variant="link" component="a" href={toLandingPageUrl}>
55+
<Button variant={ButtonVariant.primary} component="a" href={toLandingPageUrl}>
5856
{toLandingPageText}
5957
</Button>
6058
))}
59+
<EmptyStateActions>
60+
{secondaryActions ? <EmptyStateActions>{secondaryActions}</EmptyStateActions> : null}
6161
</EmptyStateActions>
6262
</EmptyStateFooter>
6363
</EmptyState>

0 commit comments

Comments
 (0)