import type { ReactNode } from 'react';

export interface ScreenHeaderProps {
  title: string;
  description?: string;
  actions?: ReactNode;
  className?: string;
  headingId?: string;
}

export function ScreenHeader({
  title,
  description,
  actions,
  className,
  headingId,
}: ScreenHeaderProps): JSX.Element {
  return (
    <div className={className ? `admin-screen__header ${className}` : 'admin-screen__header'}>
      <div>
        <h1 id={headingId || undefined} className="admin-display text-2xl text-fg">
          {title}
        </h1>
        {description ? <p className="text-sm text-fg-muted">{description}</p> : null}
      </div>
      {actions ? <div>{actions}</div> : null}
    </div>
  );
}
