File tree Expand file tree Collapse file tree 3 files changed +138
-21
lines changed Expand file tree Collapse file tree 3 files changed +138
-21
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import {
22
22
hasError ,
23
23
isApiValidationError ,
24
24
} from "api/errors" ;
25
+ import { InputGroup } from "components/InputGroup/InputGroup" ;
25
26
import { Loader } from "components/Loader/Loader" ;
26
27
import {
27
28
Search ,
@@ -212,7 +213,7 @@ export const Filter: FC<FilterProps> = ({
212
213
skeleton
213
214
) : (
214
215
< >
215
- < div css = { { display : "flex" , width : "100%" } } >
216
+ < InputGroup css = { { width : "100%" } } >
216
217
< PresetMenu
217
218
onSelect = { ( query ) => filter . update ( query ) }
218
219
presets = { presets }
@@ -221,7 +222,7 @@ export const Filter: FC<FilterProps> = ({
221
222
learnMoreLink2 = { learnMoreLink2 }
222
223
/>
223
224
< SearchField
224
- fullWidth
225
+ css = { { flex : 1 } }
225
226
error = { shouldDisplayError }
226
227
helperText = {
227
228
shouldDisplayError
@@ -242,21 +243,9 @@ export const Filter: FC<FilterProps> = ({
242
243
setQueryCopy ( filter . query ) ;
243
244
}
244
245
} ,
245
- sx : {
246
- borderRadius : "6px" ,
247
- borderTopLeftRadius : 0 ,
248
- borderBottomLeftRadius : 0 ,
249
- marginLeft : "-1px" ,
250
- "&:hover" : {
251
- zIndex : 2 ,
252
- } ,
253
- "&.Mui-error" : {
254
- zIndex : 3 ,
255
- } ,
256
- } ,
257
246
} }
258
247
/>
259
- </ div >
248
+ </ InputGroup >
260
249
{ options }
261
250
</ >
262
251
) }
@@ -288,12 +277,6 @@ const PresetMenu: FC<PresetMenuProps> = ({
288
277
< Button
289
278
onClick = { ( ) => setIsOpen ( true ) }
290
279
ref = { anchorRef }
291
- css = { {
292
- borderTopRightRadius : 0 ,
293
- borderBottomRightRadius : 0 ,
294
- flexShrink : 0 ,
295
- zIndex : 1 ,
296
- } }
297
280
endIcon = { < KeyboardArrowDown /> }
298
281
>
299
282
Filters
Original file line number Diff line number Diff line change
1
+ import Button from "@mui/material/Button" ;
2
+ import TextField from "@mui/material/TextField" ;
3
+ import type { Meta , StoryObj } from "@storybook/react" ;
4
+ import { InputGroup } from "./InputGroup" ;
5
+
6
+ const meta : Meta < typeof InputGroup > = {
7
+ title : "components/InputGroup" ,
8
+ component : InputGroup ,
9
+ } ;
10
+
11
+ export default meta ;
12
+ type Story = StoryObj < typeof InputGroup > ;
13
+
14
+ export const Default : Story = {
15
+ args : {
16
+ children : (
17
+ < >
18
+ < Button > Menu</ Button >
19
+ < TextField size = "small" placeholder = "Search..." />
20
+ </ >
21
+ ) ,
22
+ } ,
23
+ } ;
24
+
25
+ export const FocusedTextField : Story = {
26
+ args : {
27
+ children : (
28
+ < >
29
+ < Button > Menu</ Button >
30
+ < TextField autoFocus size = "small" placeholder = "Search..." />
31
+ </ >
32
+ ) ,
33
+ } ,
34
+ } ;
35
+
36
+ export const ErroredTextField : Story = {
37
+ args : {
38
+ children : (
39
+ < >
40
+ < Button > Menu</ Button >
41
+ < TextField
42
+ error
43
+ size = "small"
44
+ placeholder = "Search..."
45
+ helperText = "Some error message..."
46
+ />
47
+ </ >
48
+ ) ,
49
+ } ,
50
+ } ;
51
+
52
+ export const FocusedErroredTextField : Story = {
53
+ args : {
54
+ children : (
55
+ < >
56
+ < Button > Menu</ Button >
57
+ < TextField
58
+ autoFocus
59
+ error
60
+ size = "small"
61
+ placeholder = "Search..."
62
+ helperText = "Some error message..."
63
+ />
64
+ </ >
65
+ ) ,
66
+ } ,
67
+ } ;
68
+
69
+ export const WithThreeElements : Story = {
70
+ args : {
71
+ children : (
72
+ < >
73
+ < Button > Menu</ Button >
74
+ < TextField size = "small" placeholder = "Search..." />
75
+ < Button > Submit</ Button >
76
+ </ >
77
+ ) ,
78
+ } ,
79
+ } ;
Original file line number Diff line number Diff line change
1
+ import type { FC , HTMLProps } from "react" ;
2
+
3
+ export const InputGroup : FC < HTMLProps < HTMLDivElement > > = ( props ) => {
4
+ return (
5
+ < div
6
+ { ...props }
7
+ css = { {
8
+ "&" : {
9
+ display : "flex" ,
10
+ alignItems : "flex-start" ,
11
+ } ,
12
+
13
+ "& > *:hover" : {
14
+ zIndex : 1 ,
15
+ } ,
16
+
17
+ "& > *:not(:last-child)" : {
18
+ marginRight : - 1 ,
19
+ } ,
20
+
21
+ "& > *:first-child" : {
22
+ borderTopRightRadius : 0 ,
23
+ borderBottomRightRadius : 0 ,
24
+
25
+ "&.MuiFormControl-root .MuiInputBase-root" : {
26
+ borderTopRightRadius : 0 ,
27
+ borderBottomRightRadius : 0 ,
28
+ } ,
29
+ } ,
30
+
31
+ "& > *:last-child" : {
32
+ borderTopLeftRadius : 0 ,
33
+ borderBottomLeftRadius : 0 ,
34
+
35
+ "&.MuiFormControl-root .MuiInputBase-root" : {
36
+ borderTopLeftRadius : 0 ,
37
+ borderBottomLeftRadius : 0 ,
38
+ } ,
39
+ } ,
40
+
41
+ "& > *:not(:first-child):not(:last-child)" : {
42
+ borderRadius : 0 ,
43
+
44
+ "&.MuiFormControl-root .MuiInputBase-root" : {
45
+ borderRadius : 0 ,
46
+ } ,
47
+ } ,
48
+
49
+ "& .Mui-focused, & .Mui-error" : {
50
+ zIndex : 2 ,
51
+ } ,
52
+ } }
53
+ />
54
+ ) ;
55
+ } ;
You can’t perform that action at this time.
0 commit comments