Skip to content

Commit e355442

Browse files
committed
fix: Migrated battery to severity.
fix: Updated to migrate Battery component to Severity component. fix: Fixed site documentation. fix: Fixed broken tests and linting errors.
1 parent e84d6e8 commit e355442

23 files changed

+2938
-2441
lines changed

package-lock.json

Lines changed: 1529 additions & 1311 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 0 additions & 8 deletions
This file was deleted.

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

Lines changed: 0 additions & 4 deletions
This file was deleted.

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

Lines changed: 0 additions & 6 deletions
This file was deleted.

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

Lines changed: 0 additions & 4 deletions
This file was deleted.

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

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ section: Component groups
55
subsection: Status and state indicators
66
# Sidenav secondary level section
77
# should be the same for all markdown files
8-
id: Battery
8+
id: Severity
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
1212
# These are found through the sourceProps function provided in patternfly-docs.source.js
13-
propComponents: ['Battery']
14-
sourceLink: https://github.com/patternfly/react-component-groups/blob/main/packages/module/patternfly-docs/content/extensions/component-groups/examples/Battery/Battery.md
13+
propComponents: ['Severity']
14+
sourceLink: https://github.com/patternfly/react-component-groups/blob/main/packages/module/patternfly-docs/content/extensions/component-groups/examples/Severity/Severity.md
1515
---
1616

17-
import Battery, { BatterySeverity } from '@patternfly/react-component-groups/dist/dynamic/Battery';
17+
import Severity, { SeverityType } from '@patternfly/react-component-groups/dist/dynamic/Severity';
1818

1919
The **battery** component generates a battery, which corresponds to a level `low`, `medium`, `high` or `critical`. Each level corresponds with a severity level and respective color:
2020

@@ -27,46 +27,53 @@ The **battery** component generates a battery, which corresponds to a level `low
2727

2828
To specify the severity of the battery's risk level, you can pass a predefined enum or text value into the `severity` property that corresponds to the appropriate severity level.
2929

30-
To add an optional label to a battery, add the `label` property to the `<Battery>` component.
30+
To add an optional label to a battery, add the `label` property to the `<Severity>` component.
3131

3232
## Examples
3333

34-
### Default variant
34+
### Undefined variant
3535

36-
The default style of a battery (4 black lines) appears when any value besides "low", "medium", "high", or "critical" is passed to `severity`.
36+
The default style for the severity component appears when any value besides "none", "low", "medium", "high", or "critical" is passed to `Severity`.
3737

38-
```js file="./BatteryDefaultExample.tsx"
38+
```js file="./SeverityUndefinedExample.tsx"
3939

4040
```
41+
### None severity
4142

42-
### Low severity
43+
To style no severity, pass "none" or `SeverityType.none` to `severity`.
4344

44-
To style a battery as low severity, pass "low" or `BatterySeverity.low` to `severity`.
45+
```js file="./SeverityNoneExample.tsx"
4546

46-
```js file="./BatteryLowExample.tsx"
47+
```
48+
49+
### Minor severity
50+
51+
To style a minor severity, pass "minor" or `SeverityType.minor` to `severity`.
52+
53+
```js file="./SeverityMinorExample.tsx"
4754

4855
```
4956

50-
### Medium severity
57+
### Moderate severity
5158

52-
To style a battery as medium severity, pass "medium", or `BatterySeverity.medium` to `severity`.
59+
To style a moderate severity, pass "moderate", or `SeverityType.moderate` to `severity`.
5360

54-
```js file="./BatteryMediumExample.tsx"
61+
```js file="./SeverityModerateExample.tsx"
5562

5663
```
5764

58-
### High severity
65+
### Important severity
5966

60-
To style a battery as high severity, pass "high", or `BatterySeverity.high` to `severity`.
67+
To style an important severity, pass "important", or `SeverityType.important` to `severity`.
6168

62-
```js file="./BatteryHighExample.tsx"
69+
```js file="./SeverityImportantExample.tsx"
6370

6471
```
6572

6673
### Critical severity
6774

68-
To style a battery as critical severity, pass "critical" or `BatterySeverity.critical` to `severity`.
75+
To style a critical severity, pass "critical" or `SeverityType.critical` to `severity`.
6976

70-
```js file="./BatteryCriticalExample.tsx"
77+
```js file="./SeverityCriticalExample.tsx"
7178

7279
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import React from 'react';
2+
import Severity, { SeverityType } from '@patternfly/react-component-groups/dist/dynamic/Severity';
3+
4+
export const BasicExample: React.FunctionComponent = () => (
5+
6+
<Severity severity={SeverityType.critical} label="Critical" />
7+
8+
);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from 'react';
2+
import Severity, { SeverityType } from '@patternfly/react-component-groups/dist/dynamic/Severity';
3+
4+
export const BasicExample: React.FunctionComponent = () => (
5+
<Severity severity={SeverityType.important} label="Important" />
6+
);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import React from 'react';
2+
import Severity, { SeverityType } from '@patternfly/react-component-groups/dist/dynamic/Severity';
3+
4+
export const BasicExample: React.FunctionComponent = () => <Severity severity={SeverityType.minor} label="Minor" />;

0 commit comments

Comments
 (0)