1
+ import { type CSSObject , type Interpolation , type Theme } from "@emotion/react" ;
1
2
import Button from "@mui/material/Button" ;
2
3
import Paper from "@mui/material/Paper" ;
3
- import { makeStyles } from "@mui/styles" ;
4
- import { ConfirmDialog } from "components/Dialogs/ConfirmDialog/ConfirmDialog" ;
5
- import { Stack } from "components/Stack/Stack" ;
6
4
import dayjs from "dayjs" ;
7
5
import { useState } from "react" ;
8
- import { Pill } from "components/Pill/Pill" ;
9
6
import { compareAsc } from "date-fns" ;
10
- import { GetLicensesResponse } from "api/api" ;
7
+ import { type GetLicensesResponse } from "api/api" ;
8
+ import { ConfirmDialog } from "components/Dialogs/ConfirmDialog/ConfirmDialog" ;
9
+ import { Pill } from "components/Pill/Pill" ;
10
+ import { Stack } from "components/Stack/Stack" ;
11
11
12
12
type LicenseCardProps = {
13
13
license : GetLicensesResponse ;
@@ -24,8 +24,6 @@ export const LicenseCard = ({
24
24
onRemove,
25
25
isRemoving,
26
26
} : LicenseCardProps ) => {
27
- const styles = useStyles ( ) ;
28
-
29
27
const [ licenseIDMarkedForRemoval , setLicenseIDMarkedForRemoval ] = useState <
30
28
number | undefined
31
29
> ( undefined ) ;
@@ -34,7 +32,7 @@ export const LicenseCard = ({
34
32
license . claims . features [ "user_limit" ] || userLimitLimit ;
35
33
36
34
return (
37
- < Paper key = { license . id } elevation = { 2 } className = { styles . licenseCard } >
35
+ < Paper key = { license . id } elevation = { 2 } css = { styles . licenseCard } >
38
36
< ConfirmDialog
39
37
type = "delete"
40
38
hideCancel = { false }
@@ -55,12 +53,12 @@ export const LicenseCard = ({
55
53
< Stack
56
54
direction = "row"
57
55
spacing = { 2 }
58
- className = { styles . cardContent }
56
+ css = { styles . cardContent }
59
57
justifyContent = "left"
60
58
alignItems = "center"
61
59
>
62
- < span className = { styles . licenseId } > #{ license . id } </ span >
63
- < span className = { styles . accountType } >
60
+ < span css = { styles . licenseId } > #{ license . id } </ span >
61
+ < span css = { styles . accountType } >
64
62
{ license . claims . trial ? "Trial" : "Enterprise" }
65
63
</ span >
66
64
< Stack
@@ -73,8 +71,8 @@ export const LicenseCard = ({
73
71
} }
74
72
>
75
73
< Stack direction = "column" spacing = { 0 } alignItems = "center" >
76
- < span className = { styles . secondaryMaincolor } > Users</ span >
77
- < span className = { styles . userLimit } >
74
+ < span css = { styles . secondaryMaincolor } > Users</ span >
75
+ < span css = { styles . userLimit } >
78
76
{ userLimitActual } { ` / ${ currentUserLimit || "Unlimited" } ` }
79
77
</ span >
80
78
</ Stack >
@@ -88,23 +86,19 @@ export const LicenseCard = ({
88
86
new Date ( license . claims . license_expires * 1000 ) ,
89
87
new Date ( ) ,
90
88
) < 1 ? (
91
- < Pill
92
- className = { styles . expiredBadge }
93
- text = "Expired"
94
- type = "error"
95
- />
89
+ < Pill css = { styles . expiredBadge } text = "Expired" type = "error" />
96
90
) : (
97
- < span className = { styles . secondaryMaincolor } > Valid Until</ span >
91
+ < span css = { styles . secondaryMaincolor } > Valid Until</ span >
98
92
) }
99
- < span className = { styles . licenseExpires } >
93
+ < span css = { styles . licenseExpires } >
100
94
{ dayjs
101
95
. unix ( license . claims . license_expires )
102
96
. format ( "MMMM D, YYYY" ) }
103
97
</ span >
104
98
</ Stack >
105
99
< Stack spacing = { 2 } >
106
100
< Button
107
- className = { styles . removeButton }
101
+ css = { styles . removeButton }
108
102
variant = "contained"
109
103
size = "small"
110
104
onClick = { ( ) => setLicenseIDMarkedForRemoval ( license . id ) }
@@ -118,39 +112,39 @@ export const LicenseCard = ({
118
112
) ;
119
113
} ;
120
114
121
- const useStyles = makeStyles ( ( theme ) => ( {
122
- userLimit : {
115
+ const styles = {
116
+ userLimit : ( theme ) => ( {
123
117
color : theme . palette . text . primary ,
124
- } ,
125
- licenseCard : {
126
- ...theme . typography . body2 ,
118
+ } ) ,
119
+ licenseCard : ( theme ) => ( {
120
+ ...( theme . typography . body2 as CSSObject ) ,
127
121
padding : theme . spacing ( 2 ) ,
128
- } ,
122
+ } ) ,
129
123
cardContent : { } ,
130
- licenseId : {
124
+ licenseId : ( theme ) => ( {
131
125
color : theme . palette . secondary . main ,
132
126
fontSize : 18 ,
133
127
fontWeight : 600 ,
134
- } ,
128
+ } ) ,
135
129
accountType : {
136
130
fontWeight : 600 ,
137
131
fontSize : 18 ,
138
132
alignItems : "center" ,
139
133
textTransform : "capitalize" ,
140
134
} ,
141
- licenseExpires : {
135
+ licenseExpires : ( theme ) => ( {
142
136
color : theme . palette . text . secondary ,
143
- } ,
144
- expiredBadge : {
137
+ } ) ,
138
+ expiredBadge : ( theme ) => ( {
145
139
marginBottom : theme . spacing ( 0.5 ) ,
146
- } ,
147
- secondaryMaincolor : {
140
+ } ) ,
141
+ secondaryMaincolor : ( theme ) => ( {
148
142
color : theme . palette . text . secondary ,
149
- } ,
150
- removeButton : {
143
+ } ) ,
144
+ removeButton : ( theme ) => ( {
151
145
color : theme . palette . error . main ,
152
146
"&:hover" : {
153
147
backgroundColor : "transparent" ,
154
148
} ,
155
- } ,
156
- } ) ) ;
149
+ } ) ,
150
+ } satisfies Record < string , Interpolation < Theme > > ;
0 commit comments