1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 13:29:41 +02:00
portainer/app/react/components/Link.tsx
Chaim Lev-Ari 9600eb6fa1
refactor(tables): use add and delete buttons [EE-6297] (#10668)
Co-authored-by: Chaim Lev-Ari <chaim.levi-ari@portaienr.io>
2024-04-08 17:21:41 +03:00

25 lines
610 B
TypeScript

import { PropsWithChildren, AnchorHTMLAttributes } from 'react';
import { UISrefProps, useSref } from '@uirouter/react';
interface Props {
title?: string;
target?: AnchorHTMLAttributes<HTMLAnchorElement>['target'];
rel?: AnchorHTMLAttributes<HTMLAnchorElement>['rel'];
}
export function Link({
children,
to,
params,
options,
...props
}: PropsWithChildren<Props> & UISrefProps) {
const { onClick, href } = useSref(to, params, options);
return (
// eslint-disable-next-line react/jsx-props-no-spreading
<a onClick={onClick} href={href} {...props}>
{children}
</a>
);
}