diff --git a/common/core/components/page/PageHeader.tsx b/common/core/components/page/PageHeader.tsx new file mode 100644 index 00000000..537f76f7 --- /dev/null +++ b/common/core/components/page/PageHeader.tsx @@ -0,0 +1,59 @@ +import type { ElementType, HTMLAttributes, ReactNode } from "react"; + +function cx(...classNames: Array) { + return classNames.filter(Boolean).join(" "); +} + +type PageHeaderProps = Omit, "title"> & { + actions?: ReactNode; + as?: ElementType; + description?: ReactNode; + eyebrow?: ReactNode; + sticky?: boolean; + title: ReactNode; + titleAs?: ElementType; +}; + +export function PageHeader({ + actions, + as, + className, + description, + eyebrow, + sticky = false, + title, + titleAs, + ...props +}: PageHeaderProps) { + const Root = as ?? "header"; + const Title = titleAs ?? "h1"; + + return ( + +
+ {eyebrow ? ( +

+ {eyebrow} +

+ ) : null} + + {title} + + {description ? ( +

{description}

+ ) : null} +
+ {actions ? ( +
{actions}
+ ) : null} +
+ ); +} diff --git a/common/core/components/page/index.ts b/common/core/components/page/index.ts new file mode 100644 index 00000000..78b169af --- /dev/null +++ b/common/core/components/page/index.ts @@ -0,0 +1 @@ +export * from "./PageHeader";