Skip to content

Commit 2385c7d

Browse files
committed
fix(pf5): Migrate classNames to PF v5 ones
1 parent 13274e9 commit 2385c7d

File tree

7 files changed

+133
-93
lines changed

7 files changed

+133
-93
lines changed

packages/module/src/Battery/Battery.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@ import { createUseStyles } from 'react-jss'
99

1010
const batteryDefault = {
1111
'& svg': {
12-
'& path': { fill: 'var(--pf-global--disabled-color--200)' }
12+
'& path': { fill: 'var(--pf-v5-global--disabled-color--200)' }
1313
}
1414
};
1515

1616
const batteryLow = {
1717
'& svg': {
18-
'& path': { fill: 'var(--pf-global--success-color--100)' }
18+
'& path': { fill: 'var(--pf-v5-global--success-color--100)' }
1919
}
2020
};
2121

2222
const batteryMedium = {
2323
'& svg': {
24-
'& path': { fill: 'var(--pf-global--warning-color--100)' }
24+
'& path': { fill: 'var(--pf-v5-global--warning-color--100)' }
2525
}
2626
};
2727

2828
const batteryHigh = {
2929
'& svg': {
30-
'& path': { fill: 'var(--pf-global--palette--orange-300)' }
30+
'& path': { fill: 'var(--pf-v5-global--palette--orange-300)' }
3131
}
3232
};
3333

3434
const batteryCritical = {
3535
'& svg': {
36-
'& path': { fill: 'var(--pf-global--danger-color--100)' }
36+
'& path': { fill: 'var(--pf-v5-global--danger-color--100)' }
3737
}
3838
};
3939

@@ -43,7 +43,7 @@ const useStyles = createUseStyles({
4343
'line-height': 0,
4444
'& svg': {
4545
position: 'relative',
46-
top: 'var(--pf-global--spacer--sm)',
46+
top: 'var(--pf-v5-global--spacer--sm)',
4747
height: '1.75rem'
4848
}
4949
},

packages/module/src/DetailsPageHeader/utils/ActionMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const useStyles = createUseStyles({
7676
justifyContent: 'left'
7777
},
7878
'.pf-c-dropdown__menu-item-icon': {
79-
marginLeft: 'var(--pf-c-dropdown__menu-item-icon--MarginRight)'
79+
marginLeft: 'var(--pf-v5-c-dropdown__menu-item-icon--MarginRight)'
8080
},
8181
'.pf-c-dropdown__menu-item-main': {
8282
flexDirection: 'row-reverse',

packages/module/src/ErrorBoundary/ErrorBoundary.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ interface ErrorPageState {
2828
}
2929

3030
// As of time of writing, React only supports error boundaries in class components
31-
class ErrorBoundary extends React.Component<ErrorPageProps, ErrorPageState> {
31+
class ErrorBoundary extends React.Component<React.PropsWithChildren<ErrorPageProps>, ErrorPageState> {
3232
constructor(props: Readonly<ErrorPageProps>) {
3333
super(props);
3434
this.state = {

packages/module/src/ErrorBoundary/ErrorStack.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ interface ErrorStackProps {
99
const useStyles = createUseStyles({
1010
errorStack: {
1111
fontFamily: 'monospace',
12-
fontSize: 'var(--pf-global--icon--FontSize--md)',
12+
fontSize: 'var(--pf-v5-global--icon--FontSize--md)',
1313
textAlign: 'left',
1414
backgroundColor: 'white',
1515
borderStyle: 'solid',
16-
borderColor: 'var(--pf-global--BackgroundColor--dark-300)',
16+
borderColor: 'var(--pf-v5-global--BackgroundColor--dark-300)',
1717
overflowWrap: 'break-word',
18-
padding: 'var(--pf-global--spacer--sm)'
18+
padding: 'var(--pf-v5-global--spacer--sm)'
1919
},
2020
})
2121

packages/module/src/ErrorState/ErrorState.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@ import {
33
Button,
44
EmptyState,
55
EmptyStateBody,
6+
EmptyStateFooter,
7+
EmptyStateHeader,
68
EmptyStateIcon,
79
EmptyStateProps,
810
EmptyStateVariant,
911
Stack,
10-
StackItem, EmptyStateHeader, EmptyStateFooter,
12+
StackItem,
1113
} from '@patternfly/react-core';
1214
import { createUseStyles } from 'react-jss'
1315
import React from 'react';
1416

1517
const useStyles = createUseStyles({
1618
errorIcon: {
17-
fill: 'var(--pf-global--danger-color--100)',
19+
fill: 'var(--pf-v5-global--danger-color--100)',
1820
},
1921
})
2022

@@ -36,7 +38,8 @@ const ErrorState: React.FunctionComponent<ErrorStateProps> = ({ errorTitle = 'So
3638
<Stack>
3739
{errorDescription ? <StackItem>{errorDescription}</StackItem> : defaultErrorDescription}
3840
</Stack>
39-
</EmptyStateBody><EmptyStateFooter>
41+
</EmptyStateBody>
42+
<EmptyStateFooter>
4043
{document.referrer ? (
4144
<Button variant="primary" onClick={() => history.back()}>
4245
Return to last page
@@ -46,7 +49,8 @@ const ErrorState: React.FunctionComponent<ErrorStateProps> = ({ errorTitle = 'So
4649
Go to home page
4750
</Button>
4851
)}
49-
</EmptyStateFooter></EmptyState>
52+
</EmptyStateFooter>
53+
</EmptyState>
5054
);
5155
}
5256

packages/module/src/NotAuthorized/NotAuthorized.tsx

Lines changed: 18 additions & 14 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, } from '@patternfly/react-core';
2+
import { Button, EmptyState, EmptyStateBody, EmptyStateIcon, EmptyStateProps, EmptyStateVariant, EmptyStateHeader, EmptyStateFooter, EmptyStateActions, } from '@patternfly/react-core';
33
import { LockIcon } from '@patternfly/react-icons';
44

55
export interface NotAuthorizedProps extends Omit<EmptyStateProps, 'children' | 'title'> {
@@ -40,19 +40,23 @@ export const NotAuthorized: React.FunctionComponent<NotAuthorizedProps> = ({
4040
}: NotAuthorizedProps) => (
4141
<EmptyState variant={EmptyStateVariant.full} className={className} {...props}>
4242
<EmptyStateHeader titleText={<>{title}</>} icon={<EmptyStateIcon icon={Icon} />} headingLevel="h5" />
43-
<EmptyStateBody>{description}</EmptyStateBody><EmptyStateFooter>
44-
{actions}
45-
{showReturnButton &&
46-
(document.referrer ? (
47-
<Button variant="primary" onClick={() => history.back()}>
48-
{prevPageButtonText}
49-
</Button>
50-
) : (
51-
<Button variant="primary" component="a" href={toLandingPageUrl}>
52-
{toLandingPageText}
53-
</Button>
54-
))}
55-
</EmptyStateFooter></EmptyState>
43+
<EmptyStateBody>{description}</EmptyStateBody>
44+
<EmptyStateFooter>
45+
{actions && <EmptyStateActions>{actions}</EmptyStateActions>}
46+
<EmptyStateActions>
47+
{showReturnButton &&
48+
(document.referrer ? (
49+
<Button variant="primary" onClick={() => history.back()}>
50+
{prevPageButtonText}
51+
</Button>
52+
) : (
53+
<Button variant="primary" component="a" href={toLandingPageUrl}>
54+
{toLandingPageText}
55+
</Button>
56+
))}
57+
</EmptyStateActions>
58+
</EmptyStateFooter>
59+
</EmptyState>
5660
);
5761

5862

packages/module/src/NotAuthorized/__snapshots__/NotAuthorized.test.tsx.snap

Lines changed: 96 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,20 @@ exports[`NotAuthorized component should apply custom styles 1`] = `
4545
<div
4646
class="pf-v5-c-empty-state__footer"
4747
>
48-
<a
49-
aria-disabled="false"
50-
class="pf-v5-c-button pf-m-primary"
51-
data-ouia-component-id="OUIA-Generated-Button-primary-2"
52-
data-ouia-component-type="PF5/Button"
53-
data-ouia-safe="true"
54-
href="."
48+
<div
49+
class="pf-v5-c-empty-state__actions"
5550
>
56-
Go to landing page
57-
</a>
51+
<a
52+
aria-disabled="false"
53+
class="pf-v5-c-button pf-m-primary"
54+
data-ouia-component-id="OUIA-Generated-Button-primary-2"
55+
data-ouia-component-type="PF5/Button"
56+
data-ouia-safe="true"
57+
href="."
58+
>
59+
Go to landing page
60+
</a>
61+
</div>
5862
</div>
5963
</div>
6064
</div>
@@ -104,7 +108,11 @@ exports[`NotAuthorized component should not show buttons 1`] = `
104108
</div>
105109
<div
106110
class="pf-v5-c-empty-state__footer"
107-
/>
111+
>
112+
<div
113+
class="pf-v5-c-empty-state__actions"
114+
/>
115+
</div>
108116
</div>
109117
</div>
110118
`;
@@ -154,16 +162,20 @@ exports[`NotAuthorized component should render 1`] = `
154162
<div
155163
class="pf-v5-c-empty-state__footer"
156164
>
157-
<a
158-
aria-disabled="false"
159-
class="pf-v5-c-button pf-m-primary"
160-
data-ouia-component-id="OUIA-Generated-Button-primary-1"
161-
data-ouia-component-type="PF5/Button"
162-
data-ouia-safe="true"
163-
href="."
165+
<div
166+
class="pf-v5-c-empty-state__actions"
164167
>
165-
Go to landing page
166-
</a>
168+
<a
169+
aria-disabled="false"
170+
class="pf-v5-c-button pf-m-primary"
171+
data-ouia-component-id="OUIA-Generated-Button-primary-1"
172+
data-ouia-component-type="PF5/Button"
173+
data-ouia-safe="true"
174+
href="."
175+
>
176+
Go to landing page
177+
</a>
178+
</div>
167179
</div>
168180
</div>
169181
</div>
@@ -214,26 +226,34 @@ exports[`NotAuthorized component should show custom actions 1`] = `
214226
<div
215227
class="pf-v5-c-empty-state__footer"
216228
>
217-
<button
218-
id="action-one"
219-
>
220-
1
221-
</button>
222-
<button
223-
id="action-one"
229+
<div
230+
class="pf-v5-c-empty-state__actions"
224231
>
225-
2
226-
</button>
227-
<a
228-
aria-disabled="false"
229-
class="pf-v5-c-button pf-m-primary"
230-
data-ouia-component-id="OUIA-Generated-Button-primary-6"
231-
data-ouia-component-type="PF5/Button"
232-
data-ouia-safe="true"
233-
href="."
232+
<button
233+
id="action-one"
234+
>
235+
1
236+
</button>
237+
<button
238+
id="action-one"
239+
>
240+
2
241+
</button>
242+
</div>
243+
<div
244+
class="pf-v5-c-empty-state__actions"
234245
>
235-
Go to landing page
236-
</a>
246+
<a
247+
aria-disabled="false"
248+
class="pf-v5-c-button pf-m-primary"
249+
data-ouia-component-id="OUIA-Generated-Button-primary-6"
250+
data-ouia-component-type="PF5/Button"
251+
data-ouia-safe="true"
252+
href="."
253+
>
254+
Go to landing page
255+
</a>
256+
</div>
237257
</div>
238258
</div>
239259
</div>
@@ -284,16 +304,20 @@ exports[`NotAuthorized component should show custom description 1`] = `
284304
<div
285305
class="pf-v5-c-empty-state__footer"
286306
>
287-
<a
288-
aria-disabled="false"
289-
class="pf-v5-c-button pf-m-primary"
290-
data-ouia-component-id="OUIA-Generated-Button-primary-4"
291-
data-ouia-component-type="PF5/Button"
292-
data-ouia-safe="true"
293-
href="."
307+
<div
308+
class="pf-v5-c-empty-state__actions"
294309
>
295-
Go to landing page
296-
</a>
310+
<a
311+
aria-disabled="false"
312+
class="pf-v5-c-button pf-m-primary"
313+
data-ouia-component-id="OUIA-Generated-Button-primary-4"
314+
data-ouia-component-type="PF5/Button"
315+
data-ouia-safe="true"
316+
href="."
317+
>
318+
Go to landing page
319+
</a>
320+
</div>
297321
</div>
298322
</div>
299323
</div>
@@ -344,16 +368,20 @@ exports[`NotAuthorized component should show custom title 1`] = `
344368
<div
345369
class="pf-v5-c-empty-state__footer"
346370
>
347-
<a
348-
aria-disabled="false"
349-
class="pf-v5-c-button pf-m-primary"
350-
data-ouia-component-id="OUIA-Generated-Button-primary-5"
351-
data-ouia-component-type="PF5/Button"
352-
data-ouia-safe="true"
353-
href="."
371+
<div
372+
class="pf-v5-c-empty-state__actions"
354373
>
355-
Go to landing page
356-
</a>
374+
<a
375+
aria-disabled="false"
376+
class="pf-v5-c-button pf-m-primary"
377+
data-ouia-component-id="OUIA-Generated-Button-primary-5"
378+
data-ouia-component-type="PF5/Button"
379+
data-ouia-safe="true"
380+
href="."
381+
>
382+
Go to landing page
383+
</a>
384+
</div>
357385
</div>
358386
</div>
359387
</div>
@@ -404,16 +432,20 @@ exports[`NotAuthorized component should use custom icon 1`] = `
404432
<div
405433
class="pf-v5-c-empty-state__footer"
406434
>
407-
<a
408-
aria-disabled="false"
409-
class="pf-v5-c-button pf-m-primary"
410-
data-ouia-component-id="OUIA-Generated-Button-primary-3"
411-
data-ouia-component-type="PF5/Button"
412-
data-ouia-safe="true"
413-
href="."
435+
<div
436+
class="pf-v5-c-empty-state__actions"
414437
>
415-
Go to landing page
416-
</a>
438+
<a
439+
aria-disabled="false"
440+
class="pf-v5-c-button pf-m-primary"
441+
data-ouia-component-id="OUIA-Generated-Button-primary-3"
442+
data-ouia-component-type="PF5/Button"
443+
data-ouia-safe="true"
444+
href="."
445+
>
446+
Go to landing page
447+
</a>
448+
</div>
417449
</div>
418450
</div>
419451
</div>

0 commit comments

Comments
 (0)