2023-04-12 15:26:31 +00:00
|
|
|
import type { LucideIcon as IconType } from "lucide-react";
|
2023-02-16 22:39:57 +00:00
|
|
|
import type { ReactNode } from "react";
|
|
|
|
import React from "react";
|
2022-07-23 00:39:50 +00:00
|
|
|
|
2023-03-27 19:53:35 +00:00
|
|
|
import { classNames } from "@calcom/lib";
|
2023-02-16 22:39:57 +00:00
|
|
|
import type { SVGComponent } from "@calcom/types/SVGComponent";
|
2022-07-23 00:39:50 +00:00
|
|
|
|
2022-11-04 15:40:46 +00:00
|
|
|
import { Button } from "../../components/button";
|
2022-07-23 00:39:50 +00:00
|
|
|
|
2023-01-05 12:04:28 +00:00
|
|
|
export function EmptyScreen({
|
2022-07-23 00:39:50 +00:00
|
|
|
Icon,
|
2023-03-12 23:31:55 +00:00
|
|
|
avatar,
|
2022-07-23 00:39:50 +00:00
|
|
|
headline,
|
|
|
|
description,
|
|
|
|
buttonText,
|
|
|
|
buttonOnClick,
|
2022-08-03 16:01:29 +00:00
|
|
|
buttonRaw,
|
2023-03-27 19:53:35 +00:00
|
|
|
border = true,
|
2023-06-07 07:27:48 +00:00
|
|
|
dashedBorder = true,
|
|
|
|
className,
|
2022-07-23 00:39:50 +00:00
|
|
|
}: {
|
2023-03-12 23:31:55 +00:00
|
|
|
Icon?: SVGComponent | IconType;
|
|
|
|
avatar?: React.ReactElement;
|
|
|
|
headline: string | React.ReactElement;
|
2022-07-23 00:39:50 +00:00
|
|
|
description: string | React.ReactElement;
|
|
|
|
buttonText?: string;
|
|
|
|
buttonOnClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
2022-08-03 16:01:29 +00:00
|
|
|
buttonRaw?: ReactNode; // Used incase you want to provide your own button.
|
2023-03-27 19:53:35 +00:00
|
|
|
border?: boolean;
|
2023-06-07 07:27:48 +00:00
|
|
|
dashedBorder?: boolean;
|
|
|
|
} & React.HTMLAttributes<HTMLDivElement>) {
|
2022-07-23 00:39:50 +00:00
|
|
|
return (
|
|
|
|
<>
|
2022-09-02 19:00:41 +00:00
|
|
|
<div
|
|
|
|
data-testid="empty-screen"
|
2023-03-27 19:53:35 +00:00
|
|
|
className={classNames(
|
2023-07-04 10:29:15 +00:00
|
|
|
"flex select-none flex-col items-center justify-center rounded-lg p-7 lg:p-20",
|
2023-06-07 07:27:48 +00:00
|
|
|
border && "border-subtle border",
|
|
|
|
dashedBorder && "border-dashed",
|
|
|
|
className
|
2023-03-27 19:53:35 +00:00
|
|
|
)}>
|
2023-03-12 23:31:55 +00:00
|
|
|
{!avatar ? null : (
|
|
|
|
<div className="flex h-[72px] w-[72px] items-center justify-center rounded-full">{avatar}</div>
|
|
|
|
)}
|
|
|
|
{!Icon ? null : (
|
2023-04-05 18:14:46 +00:00
|
|
|
<div className="bg-emphasis flex h-[72px] w-[72px] items-center justify-center rounded-full ">
|
|
|
|
<Icon className="text-default inline-block h-10 w-10 stroke-[1.3px]" />
|
2023-03-12 23:31:55 +00:00
|
|
|
</div>
|
|
|
|
)}
|
2022-09-02 19:00:41 +00:00
|
|
|
<div className="flex max-w-[420px] flex-col items-center">
|
2023-04-05 18:14:46 +00:00
|
|
|
<h2 className="text-semibold font-cal text-emphasis mt-6 text-center text-xl">{headline}</h2>
|
2023-06-22 22:25:37 +00:00
|
|
|
<div className="text-default mb-8 mt-3 text-center text-sm font-normal leading-6">
|
2022-07-23 00:39:50 +00:00
|
|
|
{description}
|
2022-12-07 20:53:44 +00:00
|
|
|
</div>
|
2022-07-23 00:39:50 +00:00
|
|
|
{buttonOnClick && buttonText && <Button onClick={(e) => buttonOnClick(e)}>{buttonText}</Button>}
|
2022-08-03 16:01:29 +00:00
|
|
|
{buttonRaw}
|
2022-07-23 00:39:50 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|