Extract auth header into a separate component

This commit is contained in:
2025-08-30 10:51:51 +03:00
Unverified
parent 6f9c9a6b73
commit 1b98ee1b51
3 changed files with 116 additions and 25 deletions
+28
View File
@@ -8,4 +8,32 @@ export function AuthContainer({ children }: { children?: React.ReactNode }) {
</div>
</div>
)
}
export type IconType = "filled" | "outlined";
export interface AuthHeaderIcon {
name: string;
type: IconType
}
export interface AuthHeaderProps {
title: string;
icon: string | AuthHeaderIcon;
subtitle: string;
}
export function AuthHeader({ title, icon, subtitle }: AuthHeaderProps) {
const iconType = typeof icon == "string" ? "filled" : icon.type;
const iconName = typeof icon == "string" ? icon : icon.name;
return (
<div className="auth-header">
<h2>
<span className={`material-symbols ${iconType} large`}>{iconName}</span>
{title}
</h2>
<p>{subtitle}</p>
</div>
)
}