diff --git a/packages/features/insights/components/ChartCard.tsx b/packages/features/insights/components/ChartCard.tsx index 63ca947923dec9..b32833ee482730 100644 --- a/packages/features/insights/components/ChartCard.tsx +++ b/packages/features/insights/components/ChartCard.tsx @@ -3,7 +3,7 @@ import { Fragment, type ReactNode } from "react"; import classNames from "@calcom/ui/classNames"; -import { Button } from "@calcom/ui/components/button"; +import { PanelCard } from "@calcom/ui/components/card"; import { Tooltip } from "@calcom/ui/components/tooltip"; type LegendItem = { @@ -21,39 +21,19 @@ export function ChartCard({ legendSize, children, }: { - title: string | React.ReactNode; + title: string | ReactNode; subtitle?: string; cta?: { label: string; onClick: () => void }; legend?: Array; legendSize?: LegendSize; - children: React.ReactNode; + children: ReactNode; }) { + const legendComponent = legend && legend.length > 0 ? : null; + return ( -
-
- {typeof title === "string" ? ( -

{title}

- ) : ( - title - )} -
- {legend && legend.length > 0 && } - {cta && ( - - )} -
-
-
- {subtitle && ( -

- {subtitle} -

- )} - {children} -
-
+ + {children} + ); } diff --git a/packages/ui/components/card/PanelCard.tsx b/packages/ui/components/card/PanelCard.tsx new file mode 100644 index 00000000000000..1339d7d949c2dc --- /dev/null +++ b/packages/ui/components/card/PanelCard.tsx @@ -0,0 +1,45 @@ +import type { ReactNode } from "react"; + +import { Button } from "@calcom/ui/components/button"; + +export function PanelCard({ + title, + subtitle, + cta, + headerContent, + children, +}: { + title: string | ReactNode; + subtitle?: string; + cta?: { label: string; onClick: () => void }; + headerContent?: ReactNode; + children: ReactNode; +}) { + return ( +
+
+ {typeof title === "string" ? ( +

{title}

+ ) : ( + title + )} +
+ {headerContent} + {cta && ( + + )} +
+
+
+ {subtitle && ( +

+ {subtitle} +

+ )} + {children} +
+
+ ); +} diff --git a/packages/ui/components/card/index.ts b/packages/ui/components/card/index.ts index 3412abfa93b2d7..b733fadda4eef3 100644 --- a/packages/ui/components/card/index.ts +++ b/packages/ui/components/card/index.ts @@ -2,3 +2,4 @@ export { default as Card } from "./Card"; export type { BaseCardProps } from "./Card"; export { StepCard } from "./StepCard"; export { default as FormCard } from "./FormCard"; +export { PanelCard } from "./PanelCard";