@@ -18,10 +18,29 @@ export interface TableSearchBarProps {
1818 placeholder : string
1919 warning ?: string
2020 value : string
21+ /**
22+ * Should we go 100% width?
23+ */
24+ fullWidth ?: boolean
25+
26+ /**
27+ * Width of the whole component
28+ *
29+ * Note: fullWidth overrides this.
30+ */
31+ width ?: string | number
32+
2133 onChange : ( value : string ) => void
2234}
2335
24- export const TableSearchBar : FC < TableSearchBarProps > = ( { value, onChange, placeholder, warning } ) => {
36+ export const TableSearchBar : FC < TableSearchBarProps > = ( {
37+ value,
38+ onChange,
39+ placeholder,
40+ warning,
41+ fullWidth,
42+ width = 250 ,
43+ } ) => {
2544 const { isTablet } = useScreenSize ( )
2645
2746 const [ isWarningFresh , setIsWarningFresh ] = useState ( false )
@@ -72,7 +91,7 @@ export const TableSearchBar: FC<TableSearchBarProps> = ({ value, onChange, place
7291 verticalAlign : 'middle' ,
7392 mt : 3 ,
7493 mb : 4 ,
75- width : isTablet ? '160px' : undefined ,
94+ width : fullWidth ? '100%' : isTablet ? '160px' : undefined ,
7695 } }
7796 >
7897 < WarningIcon sx = { { mr : 3 } } />
@@ -84,10 +103,8 @@ export const TableSearchBar: FC<TableSearchBarProps> = ({ value, onChange, place
84103 < TextField
85104 sx = { {
86105 backgroundColor : COLORS . white ,
87- marginLeft : 4 ,
88- marginRight : helperText ? '25px' : '25px' ,
89106 '&:focus-within' : {
90- boxShadow : '3px 3px 3px 3px rgb(0, 0, 98, 0.25 ) !important' ,
107+ boxShadow : '3px 3px 3px 3px rgb(0, 0, 98, 0.125 ) !important' ,
91108 } ,
92109 [ `.${ inputBaseClasses . root } ` ] : {
93110 border : '1px solid' ,
@@ -101,6 +118,7 @@ export const TableSearchBar: FC<TableSearchBarProps> = ({ value, onChange, place
101118 }
102119 : { } ) ,
103120 zIndex : 10 ,
121+ ...( fullWidth ? { width : '100%' } : { } ) ,
104122 } }
105123 variant = { 'outlined' }
106124 value = { value }
@@ -109,7 +127,7 @@ export const TableSearchBar: FC<TableSearchBarProps> = ({ value, onChange, place
109127 inputProps : {
110128 sx : {
111129 p : 0 ,
112- width : isTablet ? 110 : 300 ,
130+ width : fullWidth ? '100%' : width ,
113131 margin : 2 ,
114132 } ,
115133 } ,
0 commit comments