@@ -32,6 +32,9 @@ import DialogActions from '@mui/material/DialogActions'
3232import DialogContent from '@mui/material/DialogContent'
3333import Button from '@mui/material/Button'
3434import 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'
3538
3639interface RunningSessionsSearchBarProps {
3740 searchFilter : string
@@ -40,6 +43,48 @@ interface RunningSessionsSearchBarProps {
4043 setSearchBarHelpOpen : ( value : boolean ) => void
4144}
4245
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+
4388function RunningSessionsSearchBar ( {
4489 searchFilter,
4590 handleSearch,
@@ -52,17 +97,19 @@ function RunningSessionsSearchBar ({
5297 display = 'flex'
5398 justifyContent = 'flex-end'
5499 >
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 >
66113 < IconButton
67114 sx = { { padding : '1px' } }
68115 onClick = { ( ) => setSearchBarHelpOpen ( true ) }
0 commit comments