Skip to content
Merged
2 changes: 1 addition & 1 deletion packages/react-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"tslib": "^2.8.1"
},
"devDependencies": {
"@patternfly/patternfly": "6.5.0-prerelease.12",
"@patternfly/patternfly": "6.5.0-prerelease.14",
"case-anything": "^3.1.2",
"css": "^3.0.0",
"fs-extra": "^11.3.0"
Expand Down
23 changes: 23 additions & 0 deletions packages/react-core/src/components/Card/CardSubtitle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { css } from '@patternfly/react-styles';
import styles from '@patternfly/react-styles/css/components/Card/card';

export interface CardSubtitleProps {
/** Content rendered inside the description. */
children?: React.ReactNode;
/** Additional classes added to the description. */
className?: string;
/** Id of the description. */
id?: string;
}

export const CardSubtitle: React.FunctionComponent<CardSubtitleProps> = ({
children = null,
className = '',
id = '',
...props
}: CardSubtitleProps) => (
<div {...props} id={id} className={css(styles.cardSubtitle, className)}>
{children}
</div>
);
CardSubtitle.displayName = 'CardSubtitle';
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { render, screen } from '@testing-library/react';
import { CardSubtitle } from '../CardSubtitle';

describe('CardSubtitle', () => {
test('renders with PatternFly Core styles', () => {
const { asFragment } = render(<CardSubtitle>text</CardSubtitle>);
expect(asFragment()).toMatchSnapshot();
});

test('className is added to the root element', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CardSubtitle doesn't pass className anymore, and is only used internally so this test can be removed to fix the build.

render(<CardSubtitle className="extra-class">text</CardSubtitle>);
expect(screen.getByText('text')).toHaveClass('extra-class');
});

test('extra props are spread to the root element', () => {
const testId = 'card-subtitle';

render(<CardSubtitle data-testid={testId} />);
expect(screen.getByTestId(testId)).toBeInTheDocument();
});
});
3 changes: 2 additions & 1 deletion packages/react-core/src/components/Card/examples/Card.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ propComponents:
'CardHeaderActionsObject',
'CardHeaderSelectableActionsObject',
'CardTitle',
'CardSubtitle',
'CardBody',
'CardFooter',
'CardExpandableContent'
Expand All @@ -26,7 +27,7 @@ import PlusIcon from '@patternfly/react-icons/dist/esm/icons/plus-icon';

### Basic cards

Basic cards typically have a `<CardTitle>`, `<CardBody>` and `<CardFooter>`. You may omit these components as needed, but it is recommended to at least include a `<CardBody>` to provide details about the card item.
Basic cards typically have a `<CardTitle>`, `<CardSubtitle>`, `<CardBody>` and `<CardFooter>`. You may omit these components as needed, but it is recommended to at least include a `<CardBody>` to provide details about the card item.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we want to say that cards will typically have a subtitle, or should the subtitles be just somsthing that can be added but aren't usually there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been removed and we have a seperate demo


```ts file='./CardBasic.tsx'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { Card, CardTitle, CardBody, CardFooter } from '@patternfly/react-core';
import { Card, CardTitle, CardSubtitle, CardBody, CardFooter } from '@patternfly/react-core';

export const CardBasic: React.FunctionComponent = () => (
<Card ouiaId="BasicCard">
<CardTitle>Title</CardTitle>
<CardTitle>
Title
<CardSubtitle>Subtitle</CardSubtitle>
</CardTitle>
<CardBody>Body</CardBody>
<CardFooter>Footer</CardFooter>
</Card>
Expand Down
1 change: 1 addition & 0 deletions packages/react-core/src/components/Card/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export * from './CardBody';
export * from './CardExpandableContent';
export * from './CardFooter';
export * from './CardTitle';
export * from './CardSubtitle';
export * from './CardHeader';
2 changes: 1 addition & 1 deletion packages/react-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"test:a11y": "patternfly-a11y --config patternfly-a11y.config"
},
"dependencies": {
"@patternfly/patternfly": "6.5.0-prerelease.12",
"@patternfly/patternfly": "6.5.0-prerelease.14",
"@patternfly/react-charts": "workspace:^",
"@patternfly/react-code-editor": "workspace:^",
"@patternfly/react-core": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@fortawesome/free-brands-svg-icons": "^5.15.4",
"@fortawesome/free-regular-svg-icons": "^5.15.4",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@patternfly/patternfly": "6.5.0-prerelease.12",
"@patternfly/patternfly": "6.5.0-prerelease.14",
"fs-extra": "^11.3.0",
"tslib": "^2.8.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-styles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"clean": "rimraf dist css"
},
"devDependencies": {
"@patternfly/patternfly": "6.5.0-prerelease.12",
"@patternfly/patternfly": "6.5.0-prerelease.14",
"change-case": "^5.4.4",
"fs-extra": "^11.3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-tokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"devDependencies": {
"@adobe/css-tools": "^4.4.4",
"@patternfly/patternfly": "6.5.0-prerelease.12",
"@patternfly/patternfly": "6.5.0-prerelease.14",
"fs-extra": "^11.3.0"
}
}
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4516,10 +4516,10 @@ __metadata:
languageName: node
linkType: hard

"@patternfly/patternfly@npm:6.5.0-prerelease.12":
version: 6.5.0-prerelease.12
resolution: "@patternfly/patternfly@npm:6.5.0-prerelease.12"
checksum: 10c0/a07d7ccbde0bdcdfa03877678ee73c741f1dc6774c0fe96db24e308f637e68035684bf3758e6acf3e2c51c46f27d320eff2189e85bfdeb0c9104dd18d33ae771
"@patternfly/patternfly@npm:6.5.0-prerelease.14":
version: 6.5.0-prerelease.14
resolution: "@patternfly/patternfly@npm:6.5.0-prerelease.14"
checksum: 10c0/d2bca43a2b4c98767b81dc5569eb5960866c9e7b757276b69aa8eacc06414723e3a58b434c7f1b46e416fe02474dbc333707e6c6a82ca05201900458d74ca548
languageName: node
linkType: hard

Expand Down Expand Up @@ -4617,7 +4617,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@patternfly/react-core@workspace:packages/react-core"
dependencies:
"@patternfly/patternfly": "npm:6.5.0-prerelease.12"
"@patternfly/patternfly": "npm:6.5.0-prerelease.14"
"@patternfly/react-icons": "workspace:^"
"@patternfly/react-styles": "workspace:^"
"@patternfly/react-tokens": "workspace:^"
Expand All @@ -4638,7 +4638,7 @@ __metadata:
resolution: "@patternfly/react-docs@workspace:packages/react-docs"
dependencies:
"@patternfly/documentation-framework": "npm:^6.28.9"
"@patternfly/patternfly": "npm:6.5.0-prerelease.12"
"@patternfly/patternfly": "npm:6.5.0-prerelease.14"
"@patternfly/patternfly-a11y": "npm:5.1.0"
"@patternfly/react-charts": "workspace:^"
"@patternfly/react-code-editor": "workspace:^"
Expand Down Expand Up @@ -4678,7 +4678,7 @@ __metadata:
"@fortawesome/free-brands-svg-icons": "npm:^5.15.4"
"@fortawesome/free-regular-svg-icons": "npm:^5.15.4"
"@fortawesome/free-solid-svg-icons": "npm:^5.15.4"
"@patternfly/patternfly": "npm:6.5.0-prerelease.12"
"@patternfly/patternfly": "npm:6.5.0-prerelease.14"
fs-extra: "npm:^11.3.0"
tslib: "npm:^2.8.1"
peerDependencies:
Expand Down Expand Up @@ -4763,7 +4763,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@patternfly/react-styles@workspace:packages/react-styles"
dependencies:
"@patternfly/patternfly": "npm:6.5.0-prerelease.12"
"@patternfly/patternfly": "npm:6.5.0-prerelease.14"
change-case: "npm:^5.4.4"
fs-extra: "npm:^11.3.0"
languageName: unknown
Expand Down Expand Up @@ -4805,7 +4805,7 @@ __metadata:
resolution: "@patternfly/react-tokens@workspace:packages/react-tokens"
dependencies:
"@adobe/css-tools": "npm:^4.4.4"
"@patternfly/patternfly": "npm:6.5.0-prerelease.12"
"@patternfly/patternfly": "npm:6.5.0-prerelease.14"
fs-extra: "npm:^11.3.0"
languageName: unknown
linkType: soft
Expand Down
Loading