11import { KeyboardShortcut } from '@braid-design-system/docs-ui' ;
2- import { Box , Stack , Text , Bleed , ButtonLink } from 'braid-src/lib/components' ;
2+ import {
3+ Box ,
4+ Stack ,
5+ Text ,
6+ Bleed ,
7+ ButtonLink ,
8+ Spread ,
9+ } from 'braid-src/lib/components' ;
310
411import { CategoryHeading } from '../CategoryHeading/CategoryHeading' ;
512
@@ -43,7 +50,7 @@ export const SearchResults = ({
4350 }
4451
4552 return (
46- < Stack space = "large" >
53+ < Stack space = "large" test-id = "search-results" >
4754 { ( [ 'Foundations' , 'Components' , 'CSS' , 'Logic' ] as const ) . map (
4855 ( category ) => {
4956 const items = groupedResults [ category ] ;
@@ -52,26 +59,19 @@ export const SearchResults = ({
5259 }
5360
5461 return (
55- < Stack key = { category } space = "xxsmall" component = "ul" >
56- < Box marginBottom = "xsmall" component = "li" >
57- < CategoryHeading component = "h2" > { category } </ CategoryHeading >
58- </ Box >
59- { items . map ( ( item ) => {
60- const globalIndex = flatResults . findIndex (
61- ( r ) => r . path === item . path ,
62- ) ;
63- const isSelected = globalIndex === selectedIndex ;
62+ < Stack space = "xsmall" key = { category } >
63+ < CategoryHeading component = "h2" > { category } </ CategoryHeading >
64+ < Stack space = "xxsmall" component = "ul" >
65+ { items . map ( ( item ) => {
66+ const globalIndex = flatResults . findIndex (
67+ ( r ) => r . path === item . path ,
68+ ) ;
69+ const isSelected = globalIndex === selectedIndex ;
6470
65- return (
66- < Box key = { item . path } component = "li" >
67- < Bleed horizontal = "small" >
68- < Box
69- display = "flex"
70- alignItems = "center"
71- justifyContent = "spaceBetween"
72- gap = "small"
73- >
74- < Box >
71+ return (
72+ < Box key = { item . path } component = "li" >
73+ < Bleed left = "small" >
74+ < Spread space = "small" alignY = "center" >
7575 < ButtonLink
7676 variant = { isSelected ? 'soft' : 'transparent' }
7777 tone = "formAccent"
@@ -83,19 +83,19 @@ export const SearchResults = ({
8383 >
8484 { item . name }
8585 </ ButtonLink >
86- </ Box >
8786
88- { item . hasProps && isSelected && (
89- < KeyboardShortcut
90- keys = { [ '⇧' , '⏎' ] }
91- shortcutLabel = "Props"
92- />
93- ) }
94- </ Box >
95- </ Bleed >
96- </ Box >
97- ) ;
98- } ) }
87+ { item . hasProps && isSelected && (
88+ < KeyboardShortcut
89+ keys = { [ '⇧' , '⏎' ] }
90+ shortcutLabel = "Props"
91+ />
92+ ) }
93+ </ Spread >
94+ </ Bleed >
95+ </ Box >
96+ ) ;
97+ } ) }
98+ </ Stack >
9999 </ Stack >
100100 ) ;
101101 } ,
0 commit comments