import type { ComponentProps, ComponentPropsWithRef, FC } from "react"; import { Children, createContext, isValidElement, useContext } from "react"; import { FileIcon } from "@untitledui/file-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faMagnifyingGlass } from "@fortawesome/pro-duotone-svg-icons"; const SearchLg: FC<{ className?: string }> = ({ className }) => ; import { FeaturedIcon as FeaturedIconbase } from "@/components/foundations/featured-icon/featured-icon"; import type { BackgroundPatternProps } from "@/components/shared-assets/background-patterns"; import { BackgroundPattern } from "@/components/shared-assets/background-patterns"; import { Illustration as Illustrations } from "@/components/shared-assets/illustrations"; import { cx } from "@/utils/cx"; interface RootContextProps { size?: "sm" | "md" | "lg"; } const RootContext = createContext({ size: "lg" }); interface RootProps extends ComponentPropsWithRef<"div">, RootContextProps {} const Root = ({ size = "lg", ...props }: RootProps) => { return (
); }; const FeaturedIcon = ({ color = "gray", theme = "modern", icon = SearchLg, size = "lg", ...props }: ComponentPropsWithRef) => { const { size: rootSize } = useContext(RootContext); return ; }; const Illustration = ({ type = "cloud", color = "gray", size = "lg", ...props }: ComponentPropsWithRef) => { const { size: rootSize } = useContext(RootContext); return ( ); }; interface FileTypeIconProps extends ComponentPropsWithRef<"div"> { type?: ComponentProps["type"]; theme?: ComponentProps["variant"]; } const FileTypeIcon = ({ type = "folder", theme = "solid", ...props }: FileTypeIconProps) => { return (
); }; interface HeaderProps extends ComponentPropsWithRef<"div"> { pattern?: "none" | BackgroundPatternProps["pattern"]; patternSize?: "sm" | "md" | "lg"; } const Header = ({ pattern = "circle", patternSize = "md", ...props }: HeaderProps) => { const { size } = useContext(RootContext); // Whether we are passing `Illustration` component as children. const hasIllustration = Children.toArray(props.children).some((headerChild) => isValidElement(headerChild) && headerChild.type === Illustration); return (
{pattern !== "none" && ( )} {props.children}
); }; const Content = (props: ComponentPropsWithRef<"div">) => { const { size } = useContext(RootContext); return (
); }; const Footer = (props: ComponentPropsWithRef<"div">) => { return