Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

1.8 KB
Raw Blame
import { Icon } from "@editor/ui/Icon";
import { useTranslation } from "react-i18next";
import { ActionIcon } from "@editor/ui/ActionIcon";
import { Logo } from "@editor/ui/Logo";

interface LoginHeaderProps {
  title: string;
  subtitle?: string;
  centerOnly?: boolean;
  onClose?: () => void;
}

/**
 * Desktop override of LoginHeader.
 * Renders icon + title + optional close button all in one row.
 */
export default function LoginHeader({
  title,
  subtitle,
  centerOnly = false,
  onClose,
}: LoginHeaderProps) {
  const { t } = useTranslation();

  return (
    <div
      className={`login-header${centerOnly ? " login-header-centered" : ""}`}
      style={{ marginBottom: "2rem" }}
    >
      <div
        style={{
          display: "flex",
          alignItems: "center",
          justifyContent: "space-between",
          gap: "0.75rem",
        }}
      >
        <div
          style={{
            display: "flex",
            alignItems: "center",
            gap: "0.6rem",
            flex: 1,
            minWidth: 0,
          }}
        >
          <Logo
            variant="iconOnly"
            iconHeight="2rem"
            alt="Stirling PDF"
            style={{ flexShrink: 0 }}
          />
          {title && (
            <h1 className="login-title" style={{ margin: 0 }}>
              {title}
            </h1>
          )}
        </div>
        {onClose && (
          <ActionIcon
            onClick={onClose}
            variant="tertiary"
            aria-label={t("common.close", "Close")}
            style={{
              flexShrink: 0,
              color: "var(--c-text-muted)",
              outline: "none",
            }}
          >
            <Icon name="x" size={20} />
          </ActionIcon>
        )}
      </div>
      {subtitle && <p className="login-subtitle">{subtitle}</p>}
    </div>
  );
}