bb-plane-fork/packages/propel/src/card/card.tsx
Anmol Singh Bhatia aef465415b
[WEB-4748] chore: propel utils (#7662)
* chore: tailwind merge added to propel

* chore: classname utils updated

* chore: utils import alias added

* chore: code refactor

* chore: code refactor

* chore: code refactor

* chore: code refactor

* chore: code refactor
2025-08-28 18:39:27 +05:30

41 lines
952 B
TypeScript

import * as React from "react";
import { cn } from "../utils/classname";
import {
ECardDirection,
ECardSpacing,
ECardVariant,
getCardStyle,
TCardDirection,
TCardSpacing,
TCardVariant,
} from "./helper";
export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
variant?: TCardVariant;
spacing?: TCardSpacing;
direction?: TCardDirection;
className?: string;
children: React.ReactNode;
}
const Card = React.forwardRef<HTMLDivElement, CardProps>((props, ref) => {
const {
variant = ECardVariant.WITH_SHADOW,
direction = ECardDirection.COLUMN,
className = "",
spacing = ECardSpacing.LG,
children,
...rest
} = props;
const style = getCardStyle(variant, spacing, direction);
return (
<div ref={ref} className={cn(style, className)} {...rest}>
{children}
</div>
);
});
Card.displayName = "plane-ui-card";
export { Card, ECardVariant, ECardSpacing, ECardDirection };