Skip to content

Commit aa4999d

Browse files
authored
Refactor GitHubStarsButton to wrap in Link component for external navigation (#7492)
1 parent b6c0b50 commit aa4999d

File tree

1 file changed

+31
-23
lines changed

1 file changed

+31
-23
lines changed

frontend/src/components/animate-ui/components/buttons/github-stars.tsx

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { VariantProps } from "class-variance-authority";
22

33
import { cva } from "class-variance-authority";
44
import { StarIcon } from "lucide-react";
5+
import Link from "next/link";
56

67
import type { ButtonProps as ButtonPrimitiveProps } from "@/components/animate-ui/primitives/buttons/button";
78
import type { GithubStarsProps } from "@/components/animate-ui/primitives/animate/github-stars";
@@ -71,30 +72,37 @@ function GitHubStarsButton({
7172
...props
7273
}: GitHubStarsButtonProps) {
7374
return (
74-
<GithubStars
75-
asChild
76-
username={username}
77-
repo={repo}
78-
value={value}
79-
delay={delay}
80-
inView={inView}
81-
inViewMargin={inViewMargin}
82-
inViewOnce={inViewOnce}
75+
<Link
76+
target="_blank"
77+
rel="noopener noreferrer"
78+
data-umami-event="github-stars"
79+
href={`https://github.com/${username}/${repo}`}
8380
>
84-
<ButtonPrimitive className={cn(buttonVariants({ variant, size, className }))} {...props}>
85-
<GithubStarsLogo />
86-
<GithubStarsNumber />
87-
<GithubStarsParticles className="text-yellow-500">
88-
<GithubStarsIcon
89-
icon={StarIcon}
90-
data-variant={variant}
91-
className={cn(buttonStarVariants({ variant }))}
92-
activeClassName="text-yellow-500"
93-
size={18}
94-
/>
95-
</GithubStarsParticles>
96-
</ButtonPrimitive>
97-
</GithubStars>
81+
<GithubStars
82+
asChild
83+
username={username}
84+
repo={repo}
85+
value={value}
86+
delay={delay}
87+
inView={inView}
88+
inViewMargin={inViewMargin}
89+
inViewOnce={inViewOnce}
90+
>
91+
<ButtonPrimitive className={cn(buttonVariants({ variant, size, className }))} {...props}>
92+
<GithubStarsLogo />
93+
<GithubStarsNumber />
94+
<GithubStarsParticles className="text-yellow-500">
95+
<GithubStarsIcon
96+
icon={StarIcon}
97+
data-variant={variant}
98+
className={cn(buttonStarVariants({ variant }))}
99+
activeClassName="text-yellow-500"
100+
size={18}
101+
/>
102+
</GithubStarsParticles>
103+
</ButtonPrimitive>
104+
</GithubStars>
105+
</Link>
98106
);
99107
}
100108

0 commit comments

Comments
 (0)