1
- import { makeStyles } from "@mui/styles" ;
2
1
import { type FC , type PropsWithChildren , type ReactNode } from "react" ;
3
- import { combineClasses } from "utils/combineClasses" ;
4
2
import { Stack } from "../Stack/Stack" ;
5
3
6
4
export interface PageHeaderProps {
@@ -13,16 +11,37 @@ export const PageHeader: FC<PropsWithChildren<PageHeaderProps>> = ({
13
11
actions,
14
12
className,
15
13
} ) => {
16
- const styles = useStyles ( { } ) ;
17
-
18
14
return (
19
15
< header
20
- className = { combineClasses ( [ styles . root , className ] ) }
16
+ className = { className }
17
+ css = { ( theme ) => ( {
18
+ display : "flex" ,
19
+ alignItems : "center" ,
20
+ paddingTop : theme . spacing ( 6 ) ,
21
+ paddingBottom : theme . spacing ( 6 ) ,
22
+ gap : theme . spacing ( 4 ) ,
23
+
24
+ [ theme . breakpoints . down ( "md" ) ] : {
25
+ flexDirection : "column" ,
26
+ alignItems : "flex-start" ,
27
+ } ,
28
+ } ) }
21
29
data-testid = "header"
22
30
>
23
31
< hgroup > { children } </ hgroup >
24
32
{ actions && (
25
- < Stack direction = "row" className = { styles . actions } >
33
+ < Stack
34
+ direction = "row"
35
+ css = { ( theme ) => ( {
36
+ marginLeft : "auto" ,
37
+
38
+ [ theme . breakpoints . down ( "md" ) ] : {
39
+ marginTop : theme . spacing ( 3 ) ,
40
+ marginLeft : "initial" ,
41
+ width : "100%" ,
42
+ } ,
43
+ } ) }
44
+ >
26
45
{ actions }
27
46
</ Stack >
28
47
) }
@@ -33,75 +52,54 @@ export const PageHeader: FC<PropsWithChildren<PageHeaderProps>> = ({
33
52
export const PageHeaderTitle : FC < PropsWithChildren < unknown > > = ( {
34
53
children,
35
54
} ) => {
36
- const styles = useStyles ( { } ) ;
37
-
38
- return < h1 className = { styles . title } > { children } </ h1 > ;
55
+ return (
56
+ < h1
57
+ css = { ( theme ) => ( {
58
+ fontSize : theme . spacing ( 3 ) ,
59
+ fontWeight : 400 ,
60
+ margin : 0 ,
61
+ display : "flex" ,
62
+ alignItems : "center" ,
63
+ lineHeight : "140%" ,
64
+ } ) }
65
+ >
66
+ { children }
67
+ </ h1 >
68
+ ) ;
39
69
} ;
40
70
41
71
export const PageHeaderSubtitle : FC <
42
72
PropsWithChildren < { condensed ?: boolean } >
43
73
> = ( { children, condensed } ) => {
44
- const styles = useStyles ( {
45
- condensed,
46
- } ) ;
47
-
48
- return < h2 className = { styles . subtitle } > { children } </ h2 > ;
74
+ return (
75
+ < h2
76
+ css = { ( theme ) => ( {
77
+ fontSize : theme . spacing ( 2 ) ,
78
+ color : theme . palette . text . secondary ,
79
+ fontWeight : 400 ,
80
+ display : "block" ,
81
+ margin : 0 ,
82
+ marginTop : condensed ? theme . spacing ( 0.5 ) : theme . spacing ( 1 ) ,
83
+ lineHeight : "140%" ,
84
+ } ) }
85
+ >
86
+ { children }
87
+ </ h2 >
88
+ ) ;
49
89
} ;
50
90
51
91
export const PageHeaderCaption : FC < PropsWithChildren > = ( { children } ) => {
52
- const styles = useStyles ( { } ) ;
53
- return < span className = { styles . caption } > { children } </ span > ;
92
+ return (
93
+ < span
94
+ css = { ( theme ) => ( {
95
+ fontSize : 12 ,
96
+ color : theme . palette . text . secondary ,
97
+ fontWeight : 600 ,
98
+ textTransform : "uppercase" ,
99
+ letterSpacing : "0.1em" ,
100
+ } ) }
101
+ >
102
+ { children }
103
+ </ span >
104
+ ) ;
54
105
} ;
55
-
56
- const useStyles = makeStyles ( ( theme ) => ( {
57
- root : {
58
- display : "flex" ,
59
- alignItems : "center" ,
60
- paddingTop : theme . spacing ( 6 ) ,
61
- paddingBottom : theme . spacing ( 6 ) ,
62
- gap : theme . spacing ( 4 ) ,
63
-
64
- [ theme . breakpoints . down ( "md" ) ] : {
65
- flexDirection : "column" ,
66
- alignItems : "flex-start" ,
67
- } ,
68
- } ,
69
-
70
- title : {
71
- fontSize : theme . spacing ( 3 ) ,
72
- fontWeight : 400 ,
73
- margin : 0 ,
74
- display : "flex" ,
75
- alignItems : "center" ,
76
- lineHeight : "140%" ,
77
- } ,
78
-
79
- subtitle : {
80
- fontSize : theme . spacing ( 2 ) ,
81
- color : theme . palette . text . secondary ,
82
- fontWeight : 400 ,
83
- display : "block" ,
84
- margin : 0 ,
85
- marginTop : ( { condensed } : { condensed ?: boolean } ) =>
86
- condensed ? theme . spacing ( 0.5 ) : theme . spacing ( 1 ) ,
87
- lineHeight : "140%" ,
88
- } ,
89
-
90
- actions : {
91
- marginLeft : "auto" ,
92
-
93
- [ theme . breakpoints . down ( "md" ) ] : {
94
- marginTop : theme . spacing ( 3 ) ,
95
- marginLeft : "initial" ,
96
- width : "100%" ,
97
- } ,
98
- } ,
99
-
100
- caption : {
101
- fontSize : 12 ,
102
- color : theme . palette . text . secondary ,
103
- fontWeight : 600 ,
104
- textTransform : "uppercase" ,
105
- letterSpacing : "0.1em" ,
106
- } ,
107
- } ) ) ;
0 commit comments