mirror of
https://github.com/portainer/portainer.git
synced 2026-06-23 04:20:11 +00:00
484af3c2c8
Last system-test failure is also on dev
26 lines
604 B
TypeScript
26 lines
604 B
TypeScript
import { PropsWithChildren, AnchorHTMLAttributes } from 'react';
|
|
import { UISrefProps, useSref } from '@uirouter/react';
|
|
|
|
interface Props extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
'data-cy': string;
|
|
}
|
|
|
|
export function Link({
|
|
children,
|
|
'data-cy': dataCy,
|
|
to,
|
|
params,
|
|
options,
|
|
title,
|
|
...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} data-cy={dataCy} title={title} {...props}>
|
|
{children}
|
|
</a>
|
|
);
|
|
}
|