import classNames from 'classnames'; import './Card.scss'; export interface CardProps { header?: boolean; footer?: boolean; title?: string; footerContent?: any; variant: 'default' | 'primary' | 'success' | 'warning' | 'error'; rounded?: boolean; shadow?: boolean; paddingRequired?: boolean; size?: 'x-small' | 'small' | 'medium' | 'large'; classnames?: any; contentXPosition?: 'start' | 'center' | 'end'; contentYPosition?: 'top' | 'center' | 'bottom'; headerClasses?: ''; contentClasses?: ''; footerClasses?: ''; children?: any; } export interface CardIconProps { name: string; height?: number; width?: number; } /** * *__header__* : Boolean to show/hide header | optional | default is 'true' * *__footer__* : Boolean to show/hide footer | optional | default is 'true' * *__title__* : title of the card | optional * *__type__* : type of the card theme | default is 'primary' * *__rounded__* : Boolean to control card border radius | optional | default is 'false' * *__shadow__* : Boolean to control card shadow | optional | default is 'false' * *__paddingRequired__* : Boolean to control card content padding | optional * *__size__* : size of the header text | optional | default is 'small' * *__classnames__* : classnames to custom style the card | optional * *__contentXPosition__* : card content's horizontal position | optional | default is 'center' : 'start' | 'center' | 'end'; * *__contentYPosition__* : card content's vertical position | optional | default is 'center' : 'top' | 'center' | 'bottom'; * *__headerClasses__* : css classes for card header | optional * *__contentClasses__* : css classes for card content | optional * *__footerClasses__* : css classes for card footer | optional */ const Card = ({ variant = 'primary', header = true, footer = false, title = 'Basic card', size = 'small', rounded = false, shadow = false, paddingRequired = true, contentXPosition = 'center', contentYPosition = 'center', headerClasses = '', contentClasses = '', footerClasses = '', children = '', footerContent = '', }: CardProps) => { return (
{header && ( )} {children} {footer && ( )}
); }; //------------------------Card Content---------------------------- export interface CardContentProps { classnames?: string; children?: any; paddingRequired?: boolean; contentXPosition?: 'start' | 'center' | 'end'; contentYPosition?: 'top' | 'center' | 'bottom'; } const CardContent = ({ children = 'This is a new Card', classnames = '', paddingRequired, contentXPosition = 'center', contentYPosition = 'center', }: CardContentProps) => { return (
{children}
); }; //------------------------Card Header---------------------------- export interface CardHeaderProps { variant: 'default' | 'primary' | 'success' | 'warning' | 'error'; size?: 'x-small' | 'small' | 'medium' | 'large'; title: string; rounded?: boolean; shadow?: boolean; classnames?: string; } const CardHeader = ({ variant, size, title, rounded, shadow, }: CardHeaderProps) => { return (
{title}
); }; //------------------------Card Footer---------------------------- export interface CardFooterProps { variant: 'default' | 'primary' | 'success' | 'warning' | 'error'; size?: 'x-small' | 'small' | 'medium' | 'large'; footerContent?: any; rounded?: boolean; shadow?: boolean; classnames?: string; } const CardFooter = ({ footerContent = '', rounded = false, variant = 'default', classnames = '', }: CardFooterProps) => { return (
{footerContent}
); }; export default Card;