Move props out of downshift functions

Luke Karrys committed Oct 16, 2023 at 20:22 UTC 6ec1beb555dd84f712402bd4097b16a5753246db
2 files changed +17 -20
src/components/mobile-search.js
+4 -5
@@ -66,11 +66,10 @@ function MobileSearch({onDismiss, ...props}) {
66 >
67 <TextInput
68 leadingVisual={SearchIcon}
69 - {...getInputProps({
70 - placeholder: `Search ${siteMetadata.title}`,
71 - 'aria-label': `Search ${siteMetadata.title}`,
72 - sx: {width: '100%'},
73 - })}
69 + placeholder={`Search ${siteMetadata.title}`}
70 + aria-label={`Search ${siteMetadata.title}`}
71 + sx={{width: '100%'}}
72 + {...getInputProps()}
73 />
74 </motion.div>
75 <Button sx={{ml: 3}} aria-label="Cancel" onClick={handleDismiss}>
src/components/search-results.js
+13 -15
@@ -29,21 +29,19 @@ function SearchResults({results, getItemProps, highlightedIndex}) {
29 return results.map((item, index) => (
30 <Box
31 key={item.path}
32 - {...getItemProps({
33 - item,
34 - style: {cursor: 'pointer'},
35 - sx: {
36 - display: 'flex',
37 - flexDirection: 'column',
38 - flex: '0 0 auto',
39 - px: 3,
40 - py: 2,
41 - color: 'fg.default',
42 - fontSize: 1,
43 - bg: highlightedIndex === index ? 'neutral.muted' : 'transparent',
44 - cursor: 'pointer',
45 - },
46 - })}
32 + style={{cursor: 'pointer'}}
33 + sx={{
34 + display: 'flex',
35 + flexDirection: 'column',
36 + flex: '0 0 auto',
37 + px: 3,
38 + py: 2,
39 + color: 'fg.default',
40 + fontSize: 1,
41 + bg: highlightedIndex === index ? 'neutral.muted' : 'transparent',
42 + cursor: 'pointer',
43 + }}
44 + {...getItemProps({item})}
45 >
46 <Breadcrumbs item={item} highlighted={highlightedIndex === index} />
47 {item.title}