Skip to content

Commit 13ec3ec

Browse files
committed
fix: github stars component (#237)
1 parent 23e3587 commit 13ec3ec

File tree

17 files changed

+211
-340
lines changed

17 files changed

+211
-340
lines changed

apps/gallery/app/api/github-stars/route.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

apps/gallery/components/common/header.tsx

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
11
import { SOCIAL_LINKS } from "@ux-patterns/constants/social";
2-
import { ExternalLinkIcon } from "lucide-react";
2+
import { GitHubStarsWrapper } from "@ux-patterns/ui/components/custom/github-stars-wrapper";
33
import Link from "next/link";
44
import { HeaderSearchWrapper } from "@/components/header/header-search-wrapper";
5-
import { TRACKING_CLASSES } from "@/lib/tracking";
6-
import { StarsWrapper } from "../stars/stars-wrapper";
5+
import { GALLERY_TRACKING_EVENTS, TRACKING_CLASSES } from "@/lib/tracking";
76

87
export function Header() {
98
return (
109
<header className="bg-fd-card border-b border-fd-border">
1110
<div className="container-responsive">
1211
<div className="flex items-center justify-between h-16">
1312
<div className="flex items-center space-x-6">
14-
<Link
15-
href="/"
16-
className="text-xl font-bold text-fd-foreground hover:text-fd-primary transition-colors"
17-
>
18-
UX Patterns Gallery
19-
</Link>
13+
<div className="flex items-center">
14+
<Link
15+
href="https://uxpatterns.dev"
16+
className="text-xl font-bold text-fd-foreground hover:text-fd-primary transition-colors"
17+
>
18+
UX Patterns
19+
</Link>
20+
<span className="mx-2 text-fd-muted-foreground">/</span>
21+
<Link
22+
href="/"
23+
className="text-xl font-bold text-fd-primary hover:text-fd-primary/90 transition-colors"
24+
>
25+
Gallery
26+
</Link>
27+
</div>
2028

2129
<nav className="hidden md:flex items-center space-x-6">
2230
<Link
@@ -34,29 +42,27 @@ export function Header() {
3442
</div>
3543

3644
<div className="flex items-center gap-2">
37-
<nav className="hidden md:flex items-center space-x-6">
45+
<nav className="hidden md:flex items-center space-x-1 mr-4">
3846
<Link
3947
href="https://uxpatterns.dev"
40-
className={`text-fd-muted-foreground hover:text-fd-foreground transition-colors ${TRACKING_CLASSES.MAIN_SITE_LINK_CLICK}`}
48+
className={`px-3 py-1 rounded-md text-fd-muted-foreground hover:text-fd-foreground hover:bg-fd-muted/50 transition-all ${TRACKING_CLASSES.MAIN_SITE_LINK_CLICK}`}
4149
>
4250
Patterns
43-
<span className="ml-1 inline-flex items-center">
44-
<ExternalLinkIcon className="w-4 h-4" />
45-
</span>
4651
</Link>
4752
<Link
4853
href="https://kit.uxpatterns.dev"
49-
className={`text-fd-muted-foreground hover:text-fd-foreground transition-colors ${TRACKING_CLASSES.MAIN_SITE_LINK_CLICK}`}
54+
className={`px-3 py-1 rounded-md text-fd-muted-foreground hover:text-fd-foreground hover:bg-fd-muted/50 transition-all ${TRACKING_CLASSES.MAIN_SITE_LINK_CLICK}`}
5055
>
5156
Kit
52-
<span className="ml-1 inline-flex items-center">
53-
<ExternalLinkIcon className="w-4 h-4" />
54-
</span>
5557
</Link>
5658
</nav>
5759

5860
<div className="scale-90 -mx-2">
59-
<StarsWrapper variant="small" />
61+
<GitHubStarsWrapper
62+
variant="small"
63+
asLink={true}
64+
trackingEvent={GALLERY_TRACKING_EVENTS.GITHUB_STAR_CLICK}
65+
/>
6066
</div>
6167
{SOCIAL_LINKS.filter((social) => social.label !== "GitHub").map(
6268
(social) => (

apps/gallery/components/stars/github-stars.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

apps/gallery/components/stars/stars-wrapper.tsx

Lines changed: 0 additions & 25 deletions
This file was deleted.

apps/gallery/components/stars/stars.tsx

Lines changed: 0 additions & 61 deletions
This file was deleted.

apps/kit/components/stars-wrapper.tsx

Lines changed: 0 additions & 25 deletions
This file was deleted.

apps/kit/components/stars.tsx

Lines changed: 0 additions & 57 deletions
This file was deleted.

apps/kit/lib/layout.shared.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { PROJECT } from "@ux-patterns/constants/author";
1+
import { GitHubStarsWrapper } from "@ux-patterns/ui/components/custom/github-stars-wrapper";
22
import type { BaseLayoutProps, LinkItemType } from "fumadocs-ui/layouts/shared";
33
import { siDiscord, siInstagram, siX } from "simple-icons";
4+
import { TRACKING_EVENTS } from "@/lib/tracking";
45
import { SimpleIconComponent } from "../components/simple-icon";
5-
import { StarsWrapper } from "../components/stars-wrapper";
66

77
export const linkItems: LinkItemType[] = [
88
// see https://fumadocs.dev/docs/ui/navigation/links
@@ -18,11 +18,14 @@ export const linkItems: LinkItemType[] = [
1818
},
1919
{
2020
type: "icon",
21-
url: PROJECT.repository.url,
21+
url: "https://github.com/thedaviddias/ux-patterns-for-developers",
2222
text: "GitHub Stars",
2323
icon: (
2424
<div className="scale-90 -mx-2">
25-
<StarsWrapper variant="small" />
25+
<GitHubStarsWrapper
26+
variant="small"
27+
trackingEvent={TRACKING_EVENTS.GITHUB_STAR_CLICK}
28+
/>
2629
</div>
2730
),
2831
external: true,
@@ -92,11 +95,14 @@ export function baseOptions(): BaseLayoutProps {
9295
},
9396
{
9497
type: "icon",
95-
url: PROJECT.repository.url,
98+
url: "https://github.com/thedaviddias/ux-patterns-for-developers",
9699
text: "GitHub Stars",
97100
icon: (
98101
<div className="scale-90 -mx-2">
99-
<StarsWrapper variant="small" />
102+
<GitHubStarsWrapper
103+
variant="small"
104+
trackingEvent={TRACKING_EVENTS.GITHUB_STAR_CLICK}
105+
/>
100106
</div>
101107
),
102108
external: true,

0 commit comments

Comments
 (0)