diff --git a/prediqo_web/src/shared/components/PageHeader.tsx b/prediqo_web/src/shared/components/PageHeader.tsx
index 92834c48..64da0413 100644
--- a/prediqo_web/src/shared/components/PageHeader.tsx
+++ b/prediqo_web/src/shared/components/PageHeader.tsx
@@ -13,43 +13,98 @@ export type PageHeaderProps = {
mb?: number;
};
-/** Page title row — keeps actions aligned on the right on small screens (Referral-style). */
+function renderTitle(title: ReactNode) {
+ if (typeof title === 'string') {
+ return (
+
+ {title}
+
+ );
+ }
+ return title;
+}
+
+function renderSubtitle(subtitle: ReactNode) {
+ if (typeof subtitle === 'string') {
+ return (
+
+ {subtitle}
+
+ );
+ }
+ return subtitle;
+}
+
+/**
+ * Page title row — actions stay on the title row (top-right), subtitle on a second line.
+ * Matches the Referral program layout on narrow screens.
+ */
export function PageHeader({ icon, title, subtitle, leading, actions, mb = 2 }: PageHeaderProps) {
+ const hasSubtitle = subtitle != null;
+ const columns = [
+ leading ? 'auto' : null,
+ icon ? 'auto' : null,
+ 'minmax(0, 1fr)',
+ actions != null ? 'auto' : null,
+ ]
+ .filter(Boolean)
+ .join(' ');
+
+ let col = 1;
+ const leadingCol = leading ? col++ : 0;
+ const iconCol = icon ? col++ : 0;
+ const textCol = col++;
+ const actionsCol = actions != null ? col : 0;
+
return (
-
- {leading}
- {icon}
-
- {typeof title === 'string' ? (
-
- {title}
-
- ) : (
- title
- )}
- {subtitle != null &&
- (typeof subtitle === 'string' ? (
-
- {subtitle}
-
- ) : (
- subtitle
- ))}
-
- {actions != null && (
-
- {actions}
-
+ {leading && (
+
+ {leading}
+
)}
-
+ {icon && (
+
+ {icon}
+
+ )}
+
+ {renderTitle(title)}
+
+ {hasSubtitle && (
+
+ {renderSubtitle(subtitle)}
+
+ )}
+ {actions != null && (
+
+
+ {actions}
+
+
+ )}
+
);
}
@@ -73,19 +128,22 @@ type PageSectionHeaderProps = {
mb?: number;
};
-/** Section title inside a card — title and actions stay on one row when possible. */
+/** Section title inside a card — title and actions stay on one row. */
export function PageSectionHeader({ title, actions, mb = 2 }: PageSectionHeaderProps) {
return (
-
-
+
{title}
{actions != null && {actions}}
-
+
);
}