1
+ import { css } from "@emotion/css" ;
2
+ import { type Interpolation , type Theme } from "@emotion/react" ;
1
3
import LinearProgress from "@mui/material/LinearProgress" ;
2
- import makeStyles from "@mui/styles/makeStyles" ;
3
- import { TransitionStats , Template , Workspace } from "api/typesGenerated" ;
4
- import dayjs , { Dayjs } from "dayjs" ;
5
- import { FC , useEffect , useState } from "react" ;
4
+ import type { TransitionStats , Template , Workspace } from "api/typesGenerated" ;
5
+ import dayjs , { type Dayjs } from "dayjs" ;
6
+ import { type FC , useEffect , useState } from "react" ;
6
7
import capitalize from "lodash/capitalize" ;
7
8
8
9
import duration from "dayjs/plugin/duration" ;
@@ -68,7 +69,6 @@ export const WorkspaceBuildProgress: FC<WorkspaceBuildProgressProps> = ({
68
69
workspace,
69
70
transitionStats : transitionStats ,
70
71
} ) => {
71
- const styles = useStyles ( ) ;
72
72
const job = workspace . latest_build . job ;
73
73
const [ progressValue , setProgressValue ] = useState < number | undefined > ( 0 ) ;
74
74
const [ progressText , setProgressText ] = useState < string | undefined > (
@@ -107,7 +107,7 @@ export const WorkspaceBuildProgress: FC<WorkspaceBuildProgressProps> = ({
107
107
return < > </ > ;
108
108
}
109
109
return (
110
- < div className = { styles . stack } >
110
+ < div css = { styles . stack } >
111
111
< LinearProgress
112
112
data-chromatic = "ignore"
113
113
value = { progressValue !== undefined ? progressValue : 0 }
@@ -123,37 +123,38 @@ export const WorkspaceBuildProgress: FC<WorkspaceBuildProgressProps> = ({
123
123
// If a transition is set, there is a moment on new load where the
124
124
// bar accelerates to progressValue and then rapidly decelerates, which
125
125
// is not indicative of true progress.
126
- classes = { { bar : styles . noTransition } }
126
+ classes = { {
127
+ bar : css `
128
+ transition : none;
129
+ ` ,
130
+ } }
127
131
/>
128
- < div className = { styles . barHelpers } >
129
- < div className = { styles . label } >
132
+ < div css = { styles . barHelpers } >
133
+ < div css = { styles . label } >
130
134
{ capitalize ( workspace . latest_build . status ) } workspace...
131
135
</ div >
132
- < div className = { styles . label } data-chromatic = "ignore" >
136
+ < div css = { styles . label } data-chromatic = "ignore" >
133
137
{ progressText }
134
138
</ div >
135
139
</ div >
136
140
</ div >
137
141
) ;
138
142
} ;
139
143
140
- const useStyles = makeStyles ( ( theme ) => ( {
141
- stack : {
144
+ const styles = {
145
+ stack : ( theme ) => ( {
142
146
paddingLeft : theme . spacing ( 0.2 ) ,
143
147
paddingRight : theme . spacing ( 0.2 ) ,
144
- } ,
145
- noTransition : {
146
- transition : "none" ,
147
- } ,
148
- barHelpers : {
148
+ } ) ,
149
+ barHelpers : ( theme ) => ( {
149
150
display : "flex" ,
150
151
justifyContent : "space-between" ,
151
152
marginTop : theme . spacing ( 0.5 ) ,
152
- } ,
153
- label : {
153
+ } ) ,
154
+ label : ( theme ) => ( {
154
155
fontSize : 12 ,
155
156
display : "block" ,
156
157
fontWeight : 600 ,
157
158
color : theme . palette . text . secondary ,
158
- } ,
159
- } ) ) ;
159
+ } ) ,
160
+ } satisfies Record < string , Interpolation < Theme > > ;
0 commit comments