All files / packages/components/src link.web.tsx

100% Statements 7/7
100% Branches 0/0
100% Functions 3/3
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35                    19775x         25096x             332x   332x     3860x   332x     537x    
import type React from "react";
 
import type { RightJoinProps } from "@heroui/react";
import { Link as LinkRaw } from "@heroui/react";
import type { CreateLinkProps, LinkProps } from "@tanstack/react-router";
import { createLink } from "@tanstack/react-router";
 
import { Button } from "~components/button";
import { Card } from "~components/card";
 
const RawLink = ({
	testID,
	...props
}: RightJoinProps<CreateLinkProps, React.ComponentProps<typeof LinkRaw>> & {
	testID?: string;
}) => <LinkRaw {...props} data-testid={testID} />;
export type Props = Omit<LinkProps, "children" | "color"> & {
	children?: React.ReactNode;
	className?: string;
	color?: "foreground" | "primary";
	testID?: string;
};
export const Link: React.FC<Props> = createLink(RawLink);
 
export const ButtonLink = createLink(
	(
		props: RightJoinProps<CreateLinkProps, React.ComponentProps<typeof Button>>,
	) => <Button as={LinkRaw} {...props} />,
);
export const CardLink = createLink(
	(
		props: RightJoinProps<CreateLinkProps, React.ComponentProps<typeof Card>>,
	) => <Card as={LinkRaw} {...props} />,
);