fix links in PDF

This commit is contained in:
Amruth Pillai
2022-12-02 13:55:56 +01:00
parent 686dba90c9
commit 1914ebb9ae
4 changed files with 18 additions and 10 deletions

View File

@ -1,6 +1,8 @@
import clsx from 'clsx';
import isEmpty from 'lodash/isEmpty';
import { addHttp } from '@/utils/template';
type Props = {
icon?: JSX.Element;
link?: string;
@ -11,11 +13,16 @@ type Props = {
const DataDisplay: React.FC<React.PropsWithChildren<Props>> = ({ icon, link, className, textClassName, children }) => {
if (isEmpty(children)) return null;
if (!isEmpty(link)) {
if (link && !isEmpty(link)) {
return (
<div className={clsx('inline-flex items-center gap-1', className)}>
{icon}
<a href={link} target="_blank" rel="noreferrer" className="{textClassName}">
<a
target="_blank"
rel="noreferrer"
href={addHttp(link)}
className={clsx('underline underline-offset-2', textClassName)}
>
{children}
</a>
</div>