Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/react-core/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ interface CardContextProps {
isClickable: boolean;
isSelectable: boolean;
isDisabled: boolean;
// TODO: Remove hasSelectableInput when deprecated prop is removed
hasSelectableInput: boolean;
}

interface AriaProps {
Expand Down Expand Up @@ -160,7 +162,9 @@ export const Card: React.FunctionComponent<CardProps> = ({
isExpanded,
isClickable,
isSelectable,
isDisabled
isDisabled,
// TODO: Remove hasSelectableInput when deprecated prop is removed
hasSelectableInput
}}
>
{hasSelectableInput && (
Expand Down
9 changes: 7 additions & 2 deletions packages/react-core/src/components/Card/CardHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export const CardHeader: React.FunctionComponent<CardHeaderProps> = ({
...props
}: CardHeaderProps) => (
<CardContext.Consumer>
{({ cardId, isClickable, isSelectable, isDisabled: isCardDisabled }) => {
{/* TODO: Remove hasSelectableInput when deprecated props are removed */}
{({ cardId, isClickable, isSelectable, isDisabled: isCardDisabled, hasSelectableInput }) => {
const cardHeaderToggle = (
<div className={css(styles.cardHeaderToggle)}>
<Button
Expand All @@ -97,7 +98,11 @@ export const CardHeader: React.FunctionComponent<CardHeaderProps> = ({
</div>
);

if (actions?.actions && !(isClickable && isSelectable)) {
const isClickableOrSelectableOnly = (isClickable && !isSelectable) || (isSelectable && !isClickable);
// TODO: Remove following variable and update if block when deprecated prop is removed
// We don't want to throw a warning for the deprecated card
const isDeprecatedSelectableCard = hasSelectableInput;
if (actions?.actions && isClickableOrSelectableOnly && !isDeprecatedSelectableCard) {
// eslint-disable-next-line no-console
console.warn(
`${
Expand Down