2024-02-27 19:05:50 +08:00
|
|
|
import { api_host } from '@/utils/api';
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
|
|
interface IProps extends React.PropsWithChildren {
|
|
|
|
|
documentId: string;
|
2024-03-28 16:18:16 +08:00
|
|
|
preventDefault?: boolean;
|
2024-02-27 19:05:50 +08:00
|
|
|
}
|
|
|
|
|
|
2024-03-28 16:18:16 +08:00
|
|
|
const NewDocumentLink = ({
|
|
|
|
|
children,
|
|
|
|
|
documentId,
|
|
|
|
|
preventDefault = false,
|
|
|
|
|
}: IProps) => {
|
2024-02-27 19:05:50 +08:00
|
|
|
return (
|
|
|
|
|
<a
|
|
|
|
|
target="_blank"
|
2024-03-28 16:18:16 +08:00
|
|
|
onClick={!preventDefault ? undefined : (e) => e.preventDefault()}
|
2024-02-27 19:05:50 +08:00
|
|
|
href={`${api_host}/document/get/${documentId}`}
|
|
|
|
|
rel="noreferrer"
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</a>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default NewDocumentLink;
|