2022-09-21 04:49:42 +00:00
|
|
|
import { PropsWithChildren, AnchorHTMLAttributes } from 'react';
|
2021-11-03 10:41:59 +00:00
|
|
|
import { UISref, UISrefProps } from '@uirouter/react';
|
2022-09-21 04:49:42 +00:00
|
|
|
import clsx from 'clsx';
|
2021-11-03 10:41:59 +00:00
|
|
|
|
2021-12-14 19:14:53 +00:00
|
|
|
interface Props {
|
|
|
|
title?: string;
|
2022-09-21 04:49:42 +00:00
|
|
|
target?: AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
2021-12-14 19:14:53 +00:00
|
|
|
}
|
|
|
|
|
2021-11-03 10:41:59 +00:00
|
|
|
export function Link({
|
2021-12-14 19:14:53 +00:00
|
|
|
title = '',
|
2022-09-21 04:49:42 +00:00
|
|
|
className,
|
2021-11-03 10:41:59 +00:00
|
|
|
children,
|
|
|
|
...props
|
2021-12-14 19:14:53 +00:00
|
|
|
}: PropsWithChildren<Props> & UISrefProps) {
|
2021-11-03 10:41:59 +00:00
|
|
|
return (
|
|
|
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
2022-09-21 04:49:42 +00:00
|
|
|
<UISref className={clsx('no-decoration', className)} {...props}>
|
2021-11-03 10:41:59 +00:00
|
|
|
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
2022-09-21 04:49:42 +00:00
|
|
|
<a title={title} target={props.target}>
|
|
|
|
{children}
|
|
|
|
</a>
|
2021-11-03 10:41:59 +00:00
|
|
|
</UISref>
|
|
|
|
);
|
|
|
|
}
|