-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathindex.tsx
More file actions
43 lines (36 loc) · 967 Bytes
/
index.tsx
File metadata and controls
43 lines (36 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
'use client';
import styles from '@node-core/ui-components/Common/Search/Results/Hit/index.module.css';
import Link from 'next/link';
import { useLocale } from 'next-intl';
import type { FC } from 'react';
import { getDocumentHref } from '../SearchItem/utils';
export type Document = {
path: string;
siteSection: string;
pageSectionTitle?: string;
};
type DocumentLinkProps = {
document: Document;
className?: string;
children?: React.ReactNode;
'data-focus-on-arrow-nav'?: boolean;
} & React.AnchorHTMLAttributes<HTMLAnchorElement>;
export const DocumentLink: FC<DocumentLinkProps> = ({
document,
className = styles.link,
children,
'data-focus-on-arrow-nav': dataFocusOnArrowNav,
...props
}) => {
const locale = useLocale();
return (
<Link
href={getDocumentHref(document, locale)}
className={className}
data-focus-on-arrow-nav={dataFocusOnArrowNav}
{...props}
>
{children}
</Link>
);
};