@@ -32,6 +32,9 @@ import DialogActions from '@mui/material/DialogActions'
32
32
import DialogContent from '@mui/material/DialogContent'
33
33
import Button from '@mui/material/Button'
34
34
import Box from '@mui/material/Box'
35
+ import { alpha , styled } from '@mui/material/styles'
36
+ import InputBase from '@mui/material/InputBase'
37
+ import SearchIcon from '@mui/icons-material/Search'
35
38
36
39
interface RunningSessionsSearchBarProps {
37
40
searchFilter : string
@@ -40,6 +43,48 @@ interface RunningSessionsSearchBarProps {
40
43
setSearchBarHelpOpen : ( value : boolean ) => void
41
44
}
42
45
46
+ const Search = styled ( 'div' ) ( ( { theme } ) => ( {
47
+ position : 'relative' ,
48
+ borderRadius : theme . shape . borderRadius ,
49
+ backgroundColor : alpha ( theme . palette . common . white , 0.15 ) ,
50
+ '&:hover' : {
51
+ backgroundColor : alpha ( theme . palette . common . white , 0.25 ) ,
52
+ } ,
53
+ marginLeft : 0 ,
54
+ width : '100%' ,
55
+ [ theme . breakpoints . up ( 'sm' ) ] : {
56
+ marginLeft : theme . spacing ( 1 ) ,
57
+ width : 'auto' ,
58
+ } ,
59
+ } ) ) ;
60
+
61
+ const SearchIconWrapper = styled ( 'div' ) ( ( { theme } ) => ( {
62
+ padding : theme . spacing ( 0 , 2 ) ,
63
+ height : '100%' ,
64
+ position : 'absolute' ,
65
+ pointerEvents : 'none' ,
66
+ display : 'flex' ,
67
+ alignItems : 'center' ,
68
+ justifyContent : 'center' ,
69
+ } ) ) ;
70
+
71
+ const StyledInputBase = styled ( InputBase ) ( ( { theme } ) => ( {
72
+ color : 'inherit' ,
73
+ '& .MuiInputBase-input' : {
74
+ padding : theme . spacing ( 1 , 1 , 1 , 0 ) ,
75
+ // vertical padding + font size from searchIcon
76
+ paddingLeft : `calc(1em + ${ theme . spacing ( 4 ) } )` ,
77
+ transition : theme . transitions . create ( 'width' ) ,
78
+ width : '100%' ,
79
+ [ theme . breakpoints . up ( 'sm' ) ] : {
80
+ width : '12ch' ,
81
+ '&:focus' : {
82
+ width : '20ch' ,
83
+ } ,
84
+ } ,
85
+ } ,
86
+ } ) ) ;
87
+
43
88
function RunningSessionsSearchBar ( {
44
89
searchFilter,
45
90
handleSearch,
@@ -52,17 +97,19 @@ function RunningSessionsSearchBar ({
52
97
display = 'flex'
53
98
justifyContent = 'flex-end'
54
99
>
55
- < OutlinedInput
56
- id = 'search-query-tab-running'
57
- autoFocus
58
- margin = 'dense'
59
- type = 'text'
60
- value = { searchFilter }
61
- placeholder = 'search sessions...'
62
- onChange = { ( e ) => {
63
- handleSearch ( e . target . value )
64
- } }
65
- />
100
+ < Search >
101
+ < SearchIconWrapper >
102
+ < SearchIcon />
103
+ </ SearchIconWrapper >
104
+ < StyledInputBase
105
+ id = 'search-query-tab-running'
106
+ autoFocus
107
+ value = { searchFilter }
108
+ onChange = { ( e ) => handleSearch ( e . target . value ) }
109
+ placeholder = "Search…"
110
+ inputProps = { { 'aria-label' : 'search' } }
111
+ />
112
+ </ Search >
66
113
< IconButton
67
114
sx = { { padding : '1px' } }
68
115
onClick = { ( ) => setSearchBarHelpOpen ( true ) }
0 commit comments