Skip to content

Commit 099cae0

Browse files
authored
Merge pull request #43 from edonehoo/iss9
docs(extensions): Adds documentation to each component group extension.
2 parents 521a280 + c544716 commit 099cae0

File tree

5 files changed

+79
-33
lines changed

5 files changed

+79
-33
lines changed

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

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,57 @@ propComponents: ['Battery']
1515

1616
import Battery from '@patternfly/react-component-groups/dist/dynamic/Battery';
1717

18+
The **battery** component generates a 'battery' which corresponds to a level 1-4. Each level corresponds with a severity level and respective color:
1819

19-
This is the battery component that generates a 'battery' which corresponds to a level 1-4.
20-
- 1 - low, green (best case scenario)
21-
- 2 - medium, yellow
22-
- 3 - high, orange
23-
- 4 - critical, red (worst case scenario)
20+
| Severity level | Meaning | Style |
21+
| --- | --- | --- |
22+
| Level 1 | Low severity (best case scenario) | 1 green bar | "1", "low" |
23+
| Level 2 | Medium severity | 2 yellow bars |
24+
| Level 3 | High severity | 3 orange bars |
25+
| Level 4 | Critical severity (worst case scenario) | 4 red bars |
2426

25-
Also accepts a label which can be made invisible.
27+
To specify the severity of the battery's risk level, you can pass a predefined number or text value into the `severity` property that corresponds to the appropriate severity level.
2628

29+
To add an optional label to a battery, add the `label` property to the `<Battery>` component.
2730

28-
## Component usage
31+
## Examples
32+
33+
### Default variant
34+
35+
The default style of a battery (4 black lines) appears when any value besides "1", "2", "3", or "4" is passed to `severity`.
36+
37+
```js file="./BatteryDefaultExample.tsx"
38+
39+
```
2940

3041
### Low severity
3142

43+
To style a battery as low severity, pass "1", "info", or "low" to `severity`.
44+
3245
```js file="./BatteryLowExample.tsx"
3346

3447
```
3548

3649
### Medium severity
3750

51+
To style a battery as medium severity, pass "2", "medium", or "warn" to `severity`.
52+
3853
```js file="./BatteryMediumExample.tsx"
3954

4055
```
4156

4257
### High severity
4358

59+
To style a battery as high severity, pass "3", "high", or "error" to `severity`.
60+
4461
```js file="./BatteryHighExample.tsx"
4562

4663
```
4764

4865
### Critical severity
4966

50-
```js file="./BatteryCriticalExample.tsx"
67+
To style a battery as critical severity, pass "4" or "critical" to `severity`.
5168

52-
```
53-
54-
### Default variant
55-
56-
```js file="./BatteryDefaultExample.tsx"
69+
```js file="./BatteryCriticalExample.tsx"
5770

58-
```
71+
```

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

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,45 +38,65 @@ import HorizontalNav from '@patternfly/react-component-groups/dist/dynamic/Horiz
3838
import DetailsPage from '@patternfly/react-component-groups/dist/dynamic/DetailsPage';
3939
import DetailsPageHeader from'@patternfly/react-component-groups/dist/dynamic/DetailsPageHeader';
4040

41-
## Components Usage
41+
A **details page** component is used to provide users with details on a resource that they access.
4242

43-
### DetailsPage Component
43+
## Examples
44+
45+
### Basic details page
46+
47+
A basic details page typically contains elements like `breadcrumbs`, a `pageHeading`, actions, and `tabs`.
48+
49+
Details page content should be customized within the appropriate tab to fit your use case.
4450

4551
```js file="./DetailsPageExample.tsx"
4652

4753
```
4854

49-
### DetailsPageHeader Component
55+
### Details page header
56+
57+
The `pageHeader` for a details page contains the `breadcrumbs`, `pageHeading`, and any actions.
5058

5159
```js file="./DetailsPageHeaderExample.tsx"
5260

5361
```
5462

55-
### Breadcrumbs Component
63+
### Details page breadcrumbs
64+
65+
You can specify the `children` of the details page `breadcrumbs` and the pages that they point to.
5666

5767
```js file="./BreadcrumbsExample.tsx"
5868

5969
```
6070

61-
### ActionButtons Component
71+
### Details page action buttons
72+
73+
The action buttons in a details page header can be customized to be any [button](/components/button) variant.
74+
75+
Include a [`tooltip`](/components/tooltip/) as appropriate.
6276

6377
```js file="./ActionButtonsExample.tsx"
6478

6579
```
6680

67-
### ActionMenu Component
81+
### Details page action menu
82+
83+
The details page action menu contains multiple actions that users can take.
6884

6985
```js file="./ActionMenuExample.tsx"
7086

7187
```
7288

73-
### ActionMenu with groupedActions Component
89+
### Details page action menu with grouped actions
90+
91+
To group related actions in a details page action menu, use the `groupedActions` property.
7492

7593
```js file="./ActionMenuGroupedExample.tsx"
7694

7795
```
7896

79-
### HorizonalNav Component
97+
### Details page horizontal navigation
98+
99+
A details page places `tabs` in a `<HorizontalNav>` component.
80100

81101
```js file="./HorizontalNavExample.tsx"
82102

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ section: extensions
55
subsection: Component groups
66
# Sidenav secondary level section
77
# should be the same for all markdown files
8-
id: ErrorBoundary
8+
id: Error boundary
99
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
1010
source: react
1111
# If you use typescript, the name of the interface to display props for
@@ -15,17 +15,22 @@ propComponents: ['ErrorBoundary']
1515

1616
import ErrorBoundary from "@patternfly/react-component-groups/dist/dynamic/ErrorBoundary";
1717

18-
## Component usage
18+
The **error boundary** component repurposes the `<ErrorState>` component for an application error boundary.
1919

20-
This component reuses the ErrorState component for an app error boundary.
20+
## Examples
2121

22-
### ErrorBoundary component
22+
### Basic error boundary
23+
24+
A basic error boundary has a `headerTitle`, an `errorTitle`, and lists error details when a user takes action (like selecting a link).
2325

2426
```js file="./ErrorBoundaryExample.tsx"
2527

2628
```
2729

28-
### ErrorBoundary component without error
30+
### Error boundary without error
31+
32+
If you do not wish to share error details, you can remove `throw new Error("");` and share other content instead.
33+
2934

3035
```js file="./ErrorBoundaryNoExample.tsx"
3136

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ propComponents: ['ErrorState']
1515

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

18-
## Component usage
18+
The **error state** component repurposes the `EmptyState` component to display an error to users.
1919

20-
This component reuses the EmptyState component. Also most of its props is accepted.
20+
## Examples
2121

22-
### ErrorState component
22+
### Basic error state
23+
24+
To provide users with error details, a basic error state should contain an appropriate and informative `errorTitle` and `errorDescription`.
2325

2426
```js file="./ErrorStateExample.tsx"
2527

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
---
22
section: extensions
33
subsection: Component groups
4-
id: NotAuthorized
4+
id: Not authorized
55
source: react
66
propComponents: ['NotAuthorized']
77
---
88

99
import NotAuthorized from "@patternfly/react-component-groups/dist/dynamic/NotAuthorized";
1010

11-
## Component usage
11+
A **not authorized** component displays an error screen to users when they attempt to view a page that they don't have permission to access.
1212

13-
### NotAuthorized component
13+
## Examples
14+
15+
### Basic not authorized
16+
17+
A basic not authorized component displays a title, a description, and custom actions.
18+
19+
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.
1420

1521
```js file="./NotAuthorizedExample.tsx"
1622

0 commit comments

Comments
 (0)