Skip to content

Commit 2c378d5

Browse files
committed
Spacing between search items no longer a hack
1 parent 85d90bb commit 2c378d5

File tree

1 file changed

+43
-42
lines changed

1 file changed

+43
-42
lines changed

app/components/SearchPalette.tsx

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function SearchPalette({
5151
const rowVirtualizer = useVirtual({
5252
size: (searchState.results ?? []).length,
5353
parentRef: listRef,
54-
estimateSize: useCallback(() => 62, []),
54+
estimateSize: useCallback(() => 70, []),
5555
overscan: 6,
5656
});
5757

@@ -227,52 +227,53 @@ export function SearchItem({
227227
const components = heroPath.components.slice(1);
228228

229229
return (
230-
<li
231-
{...itemProps}
232-
className={classnames(
233-
"w-full rounded-sm outline outline-4 outline-slate-800 group hover:cursor-pointer",
234-
isHighlighted ? "dark:bg-indigo-700" : "dark:bg-slate-900"
235-
)}
236-
>
237-
<div className="main-container flex items-center w-full p-2 pl-4 pr-3">
238-
<ItemIcon className="h-6 w-6 text-slate-400 group-hover:text-white"></ItemIcon>
239-
<div className="flex flex-col w-full ml-3">
240-
<div className="path flex items-center gap-1 mb-1 text-white">
241-
{components.map((c, index) => {
242-
return [
243-
<Body key={c.toString() + index + "body"} className="text-lg">
244-
{c.toString()}
245-
</Body>,
246-
].concat(
247-
index + 1 === components.length
248-
? []
249-
: [
250-
<ChevronRightIcon
251-
key={c.toString() + index + "arrow"}
252-
className="w-4 h-4"
253-
/>,
254-
]
255-
);
256-
})}
257-
</div>
258-
<div className="key-value flex justify-between">
259-
{result.item.rawValue && (
260-
<SearchResultValue
261-
isHighlighted={isHighlighted}
262-
keyName="rawValue"
263-
stringValue={result.item.rawValue}
264-
searchResult={result}
265-
/>
266-
)}
267-
{result.item.formattedValue &&
268-
result.item.formattedValue !== result.item.rawValue && (
230+
<li {...itemProps} className={classnames("w-full hover:cursor-pointer")}>
231+
<div
232+
className={classnames(
233+
"w-full h-[calc(100%-4px)] mb-2 rounded-sm group",
234+
isHighlighted ? "dark:bg-indigo-700" : "dark:bg-slate-900"
235+
)}
236+
>
237+
<div className="flex items-center w-full p-2 pl-4 pr-3">
238+
<ItemIcon className="h-6 w-6 text-slate-400 group-hover:text-white"></ItemIcon>
239+
<div className="flex flex-col w-full ml-3">
240+
<div className="path flex items-center gap-1 mb-1 text-white">
241+
{components.map((c, index) => {
242+
return [
243+
<Body key={c.toString() + index + "body"} className="text-lg">
244+
{c.toString()}
245+
</Body>,
246+
].concat(
247+
index + 1 === components.length
248+
? []
249+
: [
250+
<ChevronRightIcon
251+
key={c.toString() + index + "arrow"}
252+
className="w-4 h-4"
253+
/>,
254+
]
255+
);
256+
})}
257+
</div>
258+
<div className="key-value flex justify-between">
259+
{result.item.rawValue && (
269260
<SearchResultValue
270261
isHighlighted={isHighlighted}
271-
keyName="formattedValue"
272-
stringValue={result.item.formattedValue}
262+
keyName="rawValue"
263+
stringValue={result.item.rawValue}
273264
searchResult={result}
274265
/>
275266
)}
267+
{result.item.formattedValue &&
268+
result.item.formattedValue !== result.item.rawValue && (
269+
<SearchResultValue
270+
isHighlighted={isHighlighted}
271+
keyName="formattedValue"
272+
stringValue={result.item.formattedValue}
273+
searchResult={result}
274+
/>
275+
)}
276+
</div>
276277
</div>
277278
</div>
278279
</div>

0 commit comments

Comments
 (0)