diff --git a/packages/react-core/src/components/Card/Card.tsx b/packages/react-core/src/components/Card/Card.tsx index 979c03319c9..287f9921153 100644 --- a/packages/react-core/src/components/Card/Card.tsx +++ b/packages/react-core/src/components/Card/Card.tsx @@ -64,9 +64,9 @@ export const CardContext = React.createContext>({ }); export const Card: React.FunctionComponent = ({ - children = null, + children, id = '', - className = '', + className, component = 'div', isCompact = false, isSelectable = false, diff --git a/packages/react-core/src/components/Card/CardActions.tsx b/packages/react-core/src/components/Card/CardActions.tsx index c0443350d77..2fbe418dc6b 100644 --- a/packages/react-core/src/components/Card/CardActions.tsx +++ b/packages/react-core/src/components/Card/CardActions.tsx @@ -3,17 +3,17 @@ import { css } from '@patternfly/react-styles'; import styles from '@patternfly/react-styles/css/components/Card/card'; export interface CardActionsProps extends React.HTMLProps { - /** Content rendered inside the Card Action */ + /** Content rendered inside the card action */ children?: React.ReactNode; - /** Additional classes added to the Action */ + /** Additional classes added to the action */ className?: string; /** Flag indicating that the actions have no offset */ hasNoOffset?: boolean; } export const CardActions: React.FunctionComponent = ({ - children = null, - className = '', + children, + className, hasNoOffset = false, ...props }: CardActionsProps) => ( diff --git a/packages/react-core/src/components/Card/CardBody.tsx b/packages/react-core/src/components/Card/CardBody.tsx index c407e0b9587..cd8af73a8b9 100644 --- a/packages/react-core/src/components/Card/CardBody.tsx +++ b/packages/react-core/src/components/Card/CardBody.tsx @@ -14,8 +14,8 @@ export interface CardBodyProps extends React.HTMLProps { } export const CardBody: React.FunctionComponent = ({ - children = null, - className = '', + children, + className, component = 'div', isFilled = true, ...props diff --git a/packages/react-core/src/components/Card/CardExpandableContent.tsx b/packages/react-core/src/components/Card/CardExpandableContent.tsx index 571d7128475..9f9c538ebc9 100644 --- a/packages/react-core/src/components/Card/CardExpandableContent.tsx +++ b/packages/react-core/src/components/Card/CardExpandableContent.tsx @@ -11,8 +11,8 @@ export interface CardExpandableContentProps extends React.HTMLProps = ({ - children = null, - className = '', + children, + className, ...props }: CardExpandableContentProps) => ( diff --git a/packages/react-core/src/components/Card/CardFooter.tsx b/packages/react-core/src/components/Card/CardFooter.tsx index b9aefaffe84..cd2314f774a 100644 --- a/packages/react-core/src/components/Card/CardFooter.tsx +++ b/packages/react-core/src/components/Card/CardFooter.tsx @@ -12,8 +12,8 @@ export interface CardFooterProps extends React.HTMLProps { } export const CardFooter: React.FunctionComponent = ({ - children = null, - className = '', + children, + className, component = 'div', ...props }: CardFooterProps) => { diff --git a/packages/react-core/src/components/Card/CardHeadMain.tsx b/packages/react-core/src/components/Card/CardHeadMain.tsx deleted file mode 100644 index 92925d0ff2b..00000000000 --- a/packages/react-core/src/components/Card/CardHeadMain.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import * as React from 'react'; -import { css } from '@patternfly/react-styles'; - -export interface CardHeadMainProps extends React.HTMLProps { - /** Content rendered inside the Card Head Main */ - children?: React.ReactNode; - /** Additional classes added to the Card Head Main */ - className?: string; -} - -export const CardHeadMain: React.FunctionComponent = ({ - children = null, - className = '', - ...props -}: CardHeadMainProps) => ( -
- {children} -
-); -CardHeadMain.displayName = 'CardHeadMain'; diff --git a/packages/react-core/src/components/Card/CardHeader.tsx b/packages/react-core/src/components/Card/CardHeader.tsx index 5d4bcbf0c8c..d5a4e5dc0d0 100644 --- a/packages/react-core/src/components/Card/CardHeader.tsx +++ b/packages/react-core/src/components/Card/CardHeader.tsx @@ -2,14 +2,27 @@ import * as React from 'react'; import { css } from '@patternfly/react-styles'; import styles from '@patternfly/react-styles/css/components/Card/card'; import { CardContext } from './Card'; +import { CardHeaderMain } from './CardHeaderMain'; +import { CardActions } from './CardActions'; import { Button } from '../Button'; import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon'; +export interface CardHeaderActionsObject { + /** Actions of the card header */ + actions: React.ReactNode; + /** Flag indicating that the actions have no offset */ + hasNoOffset?: boolean; + /** Additional classes added to the actions wrapper */ + className?: string; +} + export interface CardHeaderProps extends React.HTMLProps { - /** Content rendered inside the CardHeader */ + /** Content rendered inside the card header */ children?: React.ReactNode; - /** Additional classes added to the CardHeader */ + /** Additional classes added to the card header */ className?: string; + /** Actions of the card header */ + actions?: CardHeaderActionsObject; /** ID of the card header. */ id?: string; /** Callback expandable card */ @@ -21,8 +34,9 @@ export interface CardHeaderProps extends React.HTMLProps { } export const CardHeader: React.FunctionComponent = ({ - children = null, - className = '', + children, + className, + actions, id, onExpand, toggleButtonProps, @@ -36,7 +50,7 @@ export const CardHeader: React.FunctionComponent = ({