Skip to content

Commit f152daa

Browse files
committed
Emotion conversion: Take #2
1 parent a1bcfd1 commit f152daa

File tree

14 files changed

+604
-427
lines changed

14 files changed

+604
-427
lines changed

package-lock.json

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

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"@babel/preset-flow": "^7.25.9",
3939
"@babel/preset-react": "^7.24.7",
4040
"@babel/preset-typescript": "^7.26.0",
41+
"@emotion/babel-plugin": "^11.13.5",
4142
"@octokit/rest": "^21.1.0",
4243
"@swc/core": "1.7.42",
4344
"@testing-library/dom": "^10.3.2",
@@ -83,6 +84,7 @@
8384
"whatwg-fetch": "^3.6.20"
8485
},
8586
"dependencies": {
87+
"@emotion/cache": "^11.14.0",
8688
"@patternfly/react-tokens": "^6.0.0",
8789
"sharp": "^0.33.5"
8890
}

packages/module/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"@patternfly/react-core": "^6.0.0",
3535
"@patternfly/react-icons": "^6.0.0",
3636
"@patternfly/react-table": "^6.0.0",
37+
"@emotion/react": "^11.14.0",
3738
"react-jss": "^10.10.0",
3839
"clsx": "^2.1.1"
3940
},

packages/module/src/CloseButton/CloseButton.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1+
import { jsx, css } from '@emotion/react';
12
import React from 'react';
23
import { Button, ButtonProps, ButtonVariant } from '@patternfly/react-core';
34
import { CloseIcon } from '@patternfly/react-icons';
4-
import { createUseStyles } from 'react-jss';
55
import clsx from 'clsx';
66

7-
const useStyles = createUseStyles({
8-
closeButton: {
9-
float: 'inline-end',
10-
padding: '10px 14px'
11-
},
12-
});
7+
const styles = {
8+
closeButton: css`
9+
float: inline-end;
10+
padding: 10px 14px;
11+
`
12+
};
1313

1414
/** extends ButtonProps */
1515
export interface CloseButtonProps extends ButtonProps {
@@ -24,11 +24,10 @@ export const CloseButton: React.FunctionComponent<CloseButtonProps> = ({
2424
ouiaId="CloseButton",
2525
...props
2626
}: CloseButtonProps) => {
27-
const classes = useStyles();
2827
return (
2928
<Button icon={<CloseIcon />}
3029
aria-label={props['aria-label'] || 'Close'}
31-
className={clsx(classes.closeButton, className)}
30+
css={styles.closeButton}
3231
data-test-id={dataTestID}
3332
onClick={onClick}
3433
variant={ButtonVariant.plain}

packages/module/src/ContentHeader/ContentHeader.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { css } from '@emotion/react';
23
import {
34
Flex,
45
FlexItem,
@@ -12,7 +13,6 @@ import {
1213
Divider,
1314
} from '@patternfly/react-core';
1415
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
15-
import { createUseStyles } from 'react-jss';
1616

1717
/** extends ButtonProps */
1818
export interface PageHeaderLinkProps extends ButtonProps {
@@ -41,11 +41,11 @@ export interface ContentHeaderProps {
4141
ouiaId?: string | number;
4242
}
4343

44-
const useStyles = createUseStyles({
45-
iconMinWidth: {
46-
minWidth: '48px',
47-
}
48-
});
44+
const styles = {
45+
iconMinWidth: css`
46+
min-height: 48px;
47+
`
48+
};
4949

5050
export const ContentHeader: React.FunctionComponent<React.PropsWithChildren<ContentHeaderProps>> = ({
5151
title,
@@ -57,7 +57,6 @@ export const ContentHeader: React.FunctionComponent<React.PropsWithChildren<Cont
5757
actionMenu,
5858
ouiaId = 'ContentHeader',
5959
}: ContentHeaderProps) => {
60-
const classes = useStyles();
6160
const { isExternal = false, ...linkRestProps } = linkProps ?? {};
6261

6362
return (
@@ -70,7 +69,7 @@ export const ContentHeader: React.FunctionComponent<React.PropsWithChildren<Cont
7069
<Flex>
7170
{icon && (
7271
<>
73-
<FlexItem alignSelf={{ default: 'alignSelfCenter' }} className={`${classes.iconMinWidth}`}>
72+
<FlexItem alignSelf={{ default: 'alignSelfCenter' }} css={styles.iconMinWidth} >
7473
{icon}
7574
</FlexItem>
7675
<Divider orientation={{

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

Lines changed: 70 additions & 72 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)