* Icon and IconName * Button and ButtonGroup * UserAvatar * AvatarGroup * Avatar * WizardLayout * Dialogs * EmptyScreen * showToast and TextField * Editor * Skeleton * Skeleton * TopBanner and showToast * Button again * more * perf: Remove app-store reference from @calcom/ui * more * Fixing types * Icon * Fixed casing * dropdown * more * Select * more * Badge * List * more * Divider * more * fix * fix type check * refactor * fix * fix * fix * fix * fix * fix * fix * fix type check * fix * fix * fix * fix * more * more * more * more * add index file to components/command * fix * fix * fix * fix imports * fix * fix * fix * fix * fix * fix * fix * fix build errors * fix build errors * fix --------- Co-authored-by: Keith Williams <keithwillcode@gmail.com>
30 lines
695 B
TypeScript
30 lines
695 B
TypeScript
import type { ReactNode } from "react";
|
|
|
|
import { Badge } from "@calcom/ui/components/badge";
|
|
|
|
function pluralize(opts: { num: number; plural: string; singular: string }) {
|
|
if (opts.num === 0) {
|
|
return opts.singular;
|
|
}
|
|
return opts.singular;
|
|
}
|
|
|
|
export default function SubHeadingTitleWithConnections(props: { title: ReactNode; numConnections?: number }) {
|
|
const num = props.numConnections;
|
|
return (
|
|
<>
|
|
<span>{props.title}</span>
|
|
{num ? (
|
|
<Badge variant="success">
|
|
{num}{" "}
|
|
{pluralize({
|
|
num,
|
|
singular: "connection",
|
|
plural: "connections",
|
|
})}
|
|
</Badge>
|
|
) : null}
|
|
</>
|
|
);
|
|
}
|