3
3
Card ,
4
4
CardActionArea ,
5
5
CardActions ,
6
+ CardProps ,
6
7
Grid ,
7
8
Skeleton ,
8
9
Stack ,
@@ -12,7 +13,7 @@ import {
12
13
} from '@mui/material' ;
13
14
import { To } from 'history' ;
14
15
import { ReactNode } from 'react' ;
15
- import { DateTimeOrISO } from '~/common' ;
16
+ import { DateTimeOrISO , extendSx } from '~/common' ;
16
17
import { FormattedDateTime } from '../Formatters' ;
17
18
import { HugeIcon , HugeIconProps } from '../Icons' ;
18
19
import { ButtonLink , CardActionAreaLink } from '../Routing' ;
@@ -23,6 +24,8 @@ interface FieldOverviewCardData {
23
24
to ?: To ;
24
25
}
25
26
27
+ // removed duplicate import
28
+
26
29
export interface FieldOverviewCardProps extends Pick < HugeIconProps , 'icon' > {
27
30
className ?: string ;
28
31
data ?: FieldOverviewCardData ;
@@ -34,6 +37,7 @@ export interface FieldOverviewCardProps extends Pick<HugeIconProps, 'icon'> {
34
37
redacted ?: boolean ;
35
38
title ?: string ;
36
39
viewLabel ?: string ;
40
+ CardProps ?: CardProps ;
37
41
}
38
42
39
43
const DEFAULT_EMPTY = < > </ > ;
@@ -50,17 +54,24 @@ export const FieldOverviewCard = ({
50
54
redacted,
51
55
title,
52
56
viewLabel : buttonLabel ,
57
+ CardProps,
53
58
} : FieldOverviewCardProps ) => {
54
- // Styles removed, now using sx and component props
55
-
56
59
const showData = ! loading && ! redacted ;
57
60
const ActionArea = showData && data ?. to ? CardActionAreaLink : CardActionArea ;
58
61
const Btn = data ?. to ? ButtonLink : Button ;
59
62
60
63
const card = (
61
64
< Card
62
65
className = { className }
63
- sx = { { flex : 1 , height : '100%' , display : 'flex' , flexDirection : 'column' } }
66
+ sx = { [
67
+ {
68
+ flex : 1 ,
69
+ height : '100%' ,
70
+ display : 'flex' ,
71
+ flexDirection : 'column' ,
72
+ } ,
73
+ ...extendSx ( CardProps ?. sx ) ,
74
+ ] }
64
75
>
65
76
< ActionArea
66
77
disabled = { ! data || redacted }
@@ -69,7 +80,8 @@ export const FieldOverviewCard = ({
69
80
flex : 1 ,
70
81
display : 'flex' ,
71
82
justifyContent : 'space-evenly' ,
72
- p : [ 3 , 4 ] ,
83
+ py : 3 ,
84
+ px : 4 ,
73
85
} }
74
86
onClick = { onClick }
75
87
>
0 commit comments