-
Notifications
You must be signed in to change notification settings - Fork 373
Adds CardDescription component #12105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Preview: https://pf-react-pr-12105.surge.sh A11y report: https://pf-react-pr-12105-a11y.surge.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This structure seems out of date with the core implementation
104a371 to
d741b63
Compare
| ### 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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To match the core structure, CardTitle needs a subtitle prop which passes the content and puts the cardSubtitle at a sibling level to the CardTitle's internal cardTitleText div. The current implementation is putting the cardSubtitle as a child of cardTitleText.
I think I would prefer making the subtitle prop represent only the ReactNode content and conditionally rendering the cardSubtitle div in CardTitle based on the prop, but I'd also be fine with keeping CardSubtitle as a component.
Adds tests to ensure the CardDescription component renders correctly with PatternFly Core styles, handles className, and spreads extra props to the root element.