import * as React from 'react'; import { css } from '@breakaway/react-styles'; import styles from '@breakaway/react-styles/css/components/Card/card'; import { CardContext } from './Card'; import { Button } from '../Button'; import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon'; export interface CardHeaderProps extends React.HTMLProps { /** Content rendered inside the CardHeader */ children?: React.ReactNode; /** Additional classes added to the CardHeader */ className?: string; /** ID of the card header. */ id?: string; /** Callback expandable card */ onExpand?: (event: React.MouseEvent, id: string) => void; /** Additional props for expandable toggle button */ toggleButtonProps?: any; /** Whether to right-align expandable toggle button */ isToggleRightAligned?: boolean; } export const CardHeader: React.FunctionComponent = ({ children = null, className = '', id, onExpand, toggleButtonProps, isToggleRightAligned, ...props }: CardHeaderProps) => ( {({ cardId }) => { const cardHeaderToggle = (
); return (
{onExpand && !isToggleRightAligned && cardHeaderToggle} {children} {onExpand && isToggleRightAligned && cardHeaderToggle}
); }}
); CardHeader.displayName = 'CardHeader';