@@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
2
2
import { useTranslation , Trans } from 'react-i18next' ;
3
3
import debounce from 'lodash-es/debounce' ;
4
4
import isEmpty from 'lodash-es/isEmpty' ;
5
- import { usePagination } from '@openmrs/esm-framework' ;
5
+ import { useLayoutType , usePagination } from '@openmrs/esm-framework' ;
6
6
import PaginationNav from 'carbon-components-react/es/components/PaginationNav' ;
7
7
import Search from 'carbon-components-react/es/components/Search' ;
8
8
import { Tile } from 'carbon-components-react/es/components/Tile' ;
@@ -25,6 +25,8 @@ interface PatientSearchProps {
25
25
}
26
26
27
27
const PatientSearch : React . FC < PatientSearchProps > = ( { hidePanel } ) => {
28
+ const layout = useLayoutType ( ) ;
29
+ const isTablet = React . useMemo ( ( ) => layout === 'tablet' , [ layout ] ) ;
28
30
const { t } = useTranslation ( ) ;
29
31
const [ searchTerm , setSearchTerm ] = React . useState ( '' ) ;
30
32
const [ emptyResult , setEmptyResult ] = React . useState ( false ) ;
@@ -84,38 +86,40 @@ const PatientSearch: React.FC<PatientSearchProps> = ({ hidePanel }) => {
84
86
< Search
85
87
className = { styles . patientSearchInput }
86
88
onChange = { ( $event ) => handleChange ( $event . target . value ) }
87
- placeholder = { t ( 'searchForPatient' , 'Search for a patient' ) }
89
+ placeholder = { t ( 'searchForPatient' , 'Search for a patient by name or identifier number ' ) }
88
90
labelText = ""
89
91
ref = { searchInput }
90
92
autoFocus = { true }
91
- size = "xl"
93
+ size = { isTablet ? 'xl' : 'lg' }
92
94
/>
93
95
94
- { ! isEmpty ( searchResults ) && (
95
- < div className = { styles . searchResults } >
96
- < p className = { styles . resultsText } > { t ( 'patientsFound' , { count : searchResults . length } ) } </ p >
97
- < PatientSearchResults hidePanel = { hidePanel } searchTerm = { searchTerm } patients = { results } />
98
- < div className = { styles . pagination } >
99
- < PaginationNav itemsShown = { resultsPerPage } totalItems = { totalPages } onChange = { handlePageChange } />
96
+ < div className = { styles . searchResultsContainer } >
97
+ { ! isEmpty ( searchResults ) && (
98
+ < div className = { styles . searchResults } >
99
+ < p className = { styles . resultsText } > { t ( 'patientsFound' , { count : searchResults . length } ) } </ p >
100
+ < PatientSearchResults hidePanel = { hidePanel } searchTerm = { searchTerm } patients = { results } />
101
+ < div className = { styles . pagination } >
102
+ < PaginationNav itemsShown = { resultsPerPage } totalItems = { totalPages } onChange = { handlePageChange } />
103
+ </ div >
100
104
</ div >
101
- </ div >
102
- ) }
103
- { emptyResult && (
104
- < div className = { styles . searchResults } >
105
- < p className = { styles . resultsText } > { t ( 'noResultsFound' , 'No results found' ) } </ p >
106
- < Tile className = { styles . emptySearchResultsTile } >
107
- < EmptyDataIllustration / >
108
- < p className = { styles . emptyResultText } >
109
- { t ( 'noPatientChartsFoundMessage' , 'Sorry, no patient charts have been found' ) }
110
- </ p >
111
- < p className = { styles . actionText } >
112
- < span > { t ( 'trySearchWithPatientUniqueID' , "Try searching with the patient's unique ID number" ) } </ span >
113
- < br / >
114
- < span > { t ( 'orPatientName' , "OR the patient's name(s)" ) } </ span >
115
- </ p >
116
- </ Tile >
117
- </ div >
118
- ) }
105
+ ) }
106
+ { emptyResult && (
107
+ < div className = { styles . searchResults } >
108
+ < p className = { styles . resultsText } > { t ( 'noResultsFound' , 'No results found' ) } </ p >
109
+ < Tile className = { styles . emptySearchResultsTile } >
110
+ < EmptyDataIllustration / >
111
+ < p className = { styles . emptyResultText } >
112
+ { t ( 'noPatientChartsFoundMessage' , 'Sorry, no patient charts have been found' ) }
113
+ </ p >
114
+ < p className = { styles . actionText } >
115
+ < span > { t ( 'trySearchWithPatientUniqueID' , "Try searching with the patient's unique ID number" ) } </ span >
116
+ < br / >
117
+ < span > { t ( 'orPatientName' , "OR the patient's name(s)" ) } </ span >
118
+ </ p >
119
+ </ Tile >
120
+ </ div >
121
+ ) }
122
+ </ div >
119
123
</ div >
120
124
) ;
121
125
} ;
0 commit comments