Skip to content

Commit baba3b7

Browse files
committed
fix: rounded mark + little tweaks
1 parent 4d7ffd3 commit baba3b7

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

src/app/globals.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ main :target {
3636
}
3737
}
3838

39+
mark {
40+
@apply -m-[--pad] rounded-sm p-[--pad] [--pad:0.05rem];
41+
}
42+
3943
/**
4044
* Pmndrs theme for JavaScript, CSS and HTML
4145
* Loosely based on https://marketplace.visualstudio.com/items?itemName=pmndrs.pmndrs

src/components/Search/SearchItem.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ function SearchItem({
3030
className,
3131
search,
3232
result,
33+
...props
3334
}: Omit<ComponentProps<typeof Link>, 'href'> & SearchItemProps) {
3435
return (
3536
<Link
37+
{...props}
3638
href={result.url}
3739
className={cn(className, 'block no-underline')}
3840
target={result.url.startsWith('http') ? '_blank' : undefined}

src/components/Search/SearchModalContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export const SearchModalContainer = ({ className }: ComponentProps<'search'>) =>
8787
onSelect={router.push}
8888
className="rounded-md transition-colors data-[selected=true]:bg-surface-container-high"
8989
>
90-
<SearchItem search={query} result={result} />
90+
<SearchItem search={query} result={result} tabIndex={-1} />
9191
</Command.Item>
9292
)
9393
})}

src/utils/text.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ export const escape = (text: string) => text.replace(/[|\\{}()[\]^$+*?.]/g, '\\$
77
* Bolds matching text, returning HTML.
88
*/
99
export const highlight = (text: string, target: string) =>
10-
text.replace(new RegExp(target, 'gi'), (match: string) => `<mark>${match}</mark>`)
10+
target.length > 0
11+
? text.replace(new RegExp(target, 'gi'), (match: string) => `<mark>${match}</mark>`)
12+
: text

0 commit comments

Comments
 (0)