1
+ import { css } from "@emotion/css" ;
2
+ import { type Interpolation , type Theme , useTheme } from "@emotion/react" ;
1
3
import CircularProgress from "@mui/material/CircularProgress" ;
2
- import { makeStyles } from "@mui/styles" ;
3
4
import TextField from "@mui/material/TextField" ;
4
5
import Autocomplete from "@mui/material/Autocomplete" ;
5
- import { User } from "api/typesGenerated" ;
6
+ import type { User } from "api/typesGenerated" ;
6
7
import { Avatar } from "components/Avatar/Avatar" ;
7
8
import { AvatarData } from "components/AvatarData/AvatarData" ;
8
- import { ChangeEvent , ComponentProps , FC , useState } from "react" ;
9
+ import {
10
+ type ChangeEvent ,
11
+ type ComponentProps ,
12
+ type FC ,
13
+ useState ,
14
+ } from "react" ;
9
15
import Box from "@mui/material/Box" ;
10
16
import { useDebouncedFunction } from "hooks/debounce" ;
11
17
import { useQuery } from "react-query" ;
@@ -27,7 +33,7 @@ export const UserAutocomplete: FC<UserAutocompleteProps> = ({
27
33
className,
28
34
size = "small" ,
29
35
} ) => {
30
- const styles = useStyles ( ) ;
36
+ const theme = useTheme ( ) ;
31
37
const [ autoComplete , setAutoComplete ] = useState < {
32
38
value : string ;
33
39
open : boolean ;
@@ -101,7 +107,11 @@ export const UserAutocomplete: FC<UserAutocompleteProps> = ({
101
107
size = { size }
102
108
label = { label }
103
109
placeholder = "User email or username"
104
- className = { styles . textField }
110
+ css = { {
111
+ "&:not(:has(label))" : {
112
+ margin : 0 ,
113
+ } ,
114
+ } }
105
115
InputProps = { {
106
116
...params . InputProps ,
107
117
onChange : debouncedInputOnChange ,
@@ -119,7 +129,12 @@ export const UserAutocomplete: FC<UserAutocompleteProps> = ({
119
129
</ >
120
130
) ,
121
131
classes : {
122
- root : styles . inputRoot ,
132
+ root : css `
133
+ padding-left : ${ theme . spacing (
134
+ 1.75 ,
135
+ ) } !important ; // Same padding left as input
136
+ gap : ${ theme . spacing ( 0.5 ) } ;
137
+ ` ,
123
138
} ,
124
139
} }
125
140
InputLabelProps = { {
@@ -130,15 +145,3 @@ export const UserAutocomplete: FC<UserAutocompleteProps> = ({
130
145
/>
131
146
) ;
132
147
} ;
133
-
134
- export const useStyles = makeStyles ( ( theme ) => ( {
135
- textField : {
136
- "&:not(:has(label))" : {
137
- margin : 0 ,
138
- } ,
139
- } ,
140
- inputRoot : {
141
- paddingLeft : `${ theme . spacing ( 1.75 ) } !important` , // Same padding left as input
142
- gap : theme . spacing ( 0.5 ) ,
143
- } ,
144
- } ) ) ;
0 commit comments