@@ -3,16 +3,21 @@ import { Box, Typography, Stack, Container } from "@mui/material";
33
44interface PageHeaderProps {
55 icon ?: ReactNode ;
6+ avatar ?: ReactNode ;
67 title : string ;
78 subtitle ?: string ;
8- children ?: ReactNode ; // For action buttons or tabs
9+ breadcrumbs ?: ReactNode ;
10+ chips ?: ReactNode ;
11+ children ?: ReactNode ; // For action buttons
912 statistics ?: Array < { icon : ReactNode ; value : string ; label : string } > ;
13+ tabs ?: React . ReactNode ; // Rendered flush on the header's bottom edge
1014}
1115
12- export const PageHeader : React . FC < PageHeaderProps > = ( { icon, title, subtitle, children, statistics } ) => {
16+ export const PageHeader : React . FC < PageHeaderProps > = ( { icon, avatar , title, subtitle, breadcrumbs , chips , children, statistics, tabs } ) => {
1317 return (
1418 < Box id = "page-header" sx = { {
15- background : "linear-gradient(135deg, var(--c1d3, #0D3B6E) 0%, var(--c1, #1565C0) 40%, var(--c1l2, #568BDA) 100%)" ,
19+ // Vertical gradient so the top edge is uniformly --c1d3 and blends seamlessly with the AppBar above.
20+ background : "linear-gradient(180deg, var(--c1d3, #0B2C52) 0%, var(--c1, #1565C0) 60%, var(--c1l2, #3B71C9) 100%)" ,
1621 color : "#FFF" ,
1722 position : "relative" ,
1823 left : "50%" ,
@@ -29,45 +34,55 @@ export const PageHeader: React.FC<PageHeaderProps> = ({ icon, title, subtitle, c
2934 width : 400 ,
3035 height : 400 ,
3136 borderRadius : "50%" ,
32- background : "rgba(255,255,255,0.05)" ,
33- pointerEvents : "none"
34- } ,
35- "&::after" : {
36- content : "''" ,
37- position : "absolute" ,
38- bottom : - 80 ,
39- left : - 80 ,
40- width : 300 ,
41- height : 300 ,
42- borderRadius : "50%" ,
4337 background : "rgba(255,255,255,0.04)" ,
4438 pointerEvents : "none"
4539 }
4640 } } >
47- < Container maxWidth = "xl" sx = { { position : "relative" , zIndex : 1 , paddingY : 6 } } >
41+ < Container maxWidth = "xl" sx = { { position : "relative" , zIndex : 1 , pt : 3.5 , pb : tabs ? 0 : 3.5 } } >
42+ { breadcrumbs && (
43+ < Box id = "page-header-breadcrumbs" sx = { { mb : 1.5 , fontSize : "12px" , color : "rgba(255,255,255,0.8)" } } >
44+ { breadcrumbs }
45+ </ Box >
46+ ) }
4847 < Stack direction = { { xs : "column" , md : "row" } } spacing = { { xs : 2 , md : 4 } } alignItems = { { xs : "flex-start" , md : "center" } } sx = { { width : "100%" } } >
49- { icon
48+ { ( avatar || icon )
5049 ? (
5150 < Stack id = "page-header-title-section" direction = "row" spacing = { 2 } alignItems = "center" sx = { { flex : 1 } } >
52- < Box
53- id = "page-header-icon"
54- sx = { {
55- backgroundColor : "rgba(255,255,255,0.2)" ,
56- borderRadius : "12px" ,
57- p : 1.5 ,
58- display : "flex" ,
59- alignItems : "center" ,
60- justifyContent : "center"
61- } }
62- >
63- { React . cloneElement ( icon as React . ReactElement < any > , { sx : { fontSize : 32 , color : "#FFF" } } ) }
64- </ Box >
51+ { avatar
52+ ? (
53+ < Box id = "page-header-avatar" sx = { { width : 56 , height : 56 , display : "flex" , alignItems : "center" , justifyContent : "center" , flexShrink : 0 } } >
54+ { avatar }
55+ </ Box >
56+ )
57+ : (
58+ < Box
59+ id = "page-header-icon"
60+ sx = { {
61+ backgroundColor : "rgba(255,255,255,0.2)" ,
62+ borderRadius : "12px" ,
63+ p : 1.5 ,
64+ display : "flex" ,
65+ alignItems : "center" ,
66+ justifyContent : "center"
67+ } }
68+ >
69+ { React . cloneElement ( icon as React . ReactElement < any > , { sx : { fontSize : 32 , color : "#FFF" } } ) }
70+ </ Box >
71+ )
72+ }
6573 < Box id = "page-header-text" >
66- < Typography id = "page-header-title" variant = "h3" sx = { { fontWeight : 500 , mb : 1 } } >
67- { title }
68- </ Typography >
74+ < Stack direction = "row" spacing = { 1 } alignItems = "center" >
75+ < Typography id = "page-header-title" sx = { { fontSize : "20px" , fontWeight : 650 , letterSpacing : "-0.012em" , lineHeight : 1.2 } } >
76+ { title }
77+ </ Typography >
78+ { chips && (
79+ < Stack id = "page-header-chips" direction = "row" spacing = { 1 } alignItems = "center" >
80+ { chips }
81+ </ Stack >
82+ ) }
83+ </ Stack >
6984 { subtitle && (
70- < Typography id = "page-header-subtitle" variant = "h6" sx = { { color : "rgba(255,255,255,0.85 )" , fontWeight : 400 } } >
85+ < Typography id = "page-header-subtitle" sx = { { fontSize : "12.5px" , color : "rgba(255,255,255,0.75 )" , fontWeight : 400 } } >
7186 { subtitle }
7287 </ Typography >
7388 ) }
@@ -76,11 +91,18 @@ export const PageHeader: React.FC<PageHeaderProps> = ({ icon, title, subtitle, c
7691 )
7792 : (
7893 < Box id = "page-header-text" sx = { { flex : 1 } } >
79- < Typography id = "page-header-title" variant = "h3" sx = { { fontWeight : 500 , mb : 1 } } >
80- { title }
81- </ Typography >
94+ < Stack direction = "row" spacing = { 1 } alignItems = "center" >
95+ < Typography id = "page-header-title" sx = { { fontSize : "20px" , fontWeight : 650 , letterSpacing : "-0.012em" , lineHeight : 1.2 } } >
96+ { title }
97+ </ Typography >
98+ { chips && (
99+ < Stack id = "page-header-chips" direction = "row" spacing = { 1 } alignItems = "center" >
100+ { chips }
101+ </ Stack >
102+ ) }
103+ </ Stack >
82104 { subtitle && (
83- < Typography id = "page-header-subtitle" variant = "h6" sx = { { color : "rgba(255,255,255,0.85 )" , fontWeight : 400 } } >
105+ < Typography id = "page-header-subtitle" sx = { { fontSize : "12.5px" , color : "rgba(255,255,255,0.75 )" , fontWeight : 400 } } >
84106 { subtitle }
85107 </ Typography >
86108 ) }
@@ -105,19 +127,32 @@ export const PageHeader: React.FC<PageHeaderProps> = ({ icon, title, subtitle, c
105127 </ Stack >
106128
107129 { statistics && statistics . length > 0 && (
108- < Stack id = "page-header-statistics" direction = { { xs : "column" , sm : "row" } } spacing = { 3 } sx = { { mt : 3 } } >
109- { statistics . map ( ( stat ) => (
110- < Stack key = { stat . label } direction = "row" spacing = { 1 } alignItems = "center" >
111- { React . cloneElement ( stat . icon as React . ReactElement < any > , { sx : { color : "#FFF" , fontSize : 20 } } ) }
112- < Typography variant = "h6" sx = { { color : "#FFF" , fontWeight : 600 , mr : 1 } } >
130+ < Box id = "page-header-statistics" sx = { { display : "flex" , flexWrap : "wrap" , alignItems : "flex-end" , mt : 3 } } >
131+ { statistics . map ( ( stat , i ) => (
132+ < Box
133+ key = { stat . label }
134+ sx = { {
135+ display : "flex" ,
136+ flexDirection : "column" ,
137+ px : "22px" ,
138+ ...( i === 0 ? { pl : 0 } : { borderLeft : "1px solid rgba(255,255,255,.22)" } )
139+ } }
140+ >
141+ < Typography sx = { { fontSize : "18px" , fontWeight : 650 , fontVariantNumeric : "tabular-nums" , color : "#FFF" , lineHeight : 1.25 } } >
113142 { stat . value }
114143 </ Typography >
115- < Typography variant = "body2" sx = { { color : "rgba(255,255,255,0.9)" , fontSize : "0.875rem " } } >
144+ < Typography sx = { { fontSize : "10.5px" , textTransform : "uppercase" , letterSpacing : ".07em" , color : "rgba(255,255,255,.62) " } } >
116145 { stat . label }
117146 </ Typography >
118- </ Stack >
147+ </ Box >
119148 ) ) }
120- </ Stack >
149+ </ Box >
150+ ) }
151+
152+ { tabs && (
153+ < Box id = "page-header-tabs" sx = { { mt : 3 , width : "100%" } } >
154+ { tabs }
155+ </ Box >
121156 ) }
122157 </ Container >
123158 </ Box >
0 commit comments