Skip to content

Commit c75802b

Browse files
committed
feat: add star in the header
1 parent bef38c4 commit c75802b

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

app/[lang]/layout.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import { getPageMap } from 'nextra/page-map';
1111
import { getDictionary } from '../_dictionaries/get-dictionary';
1212

1313
import PlausibleProvider from 'next-plausible';
14-
import { DiscordIcon, GitHubIcon } from "nextra/icons";
14+
import { DiscordIcon } from "nextra/icons";
1515
import '../../styles/globals.css';
1616
import { Footer } from "../_components/footer";
17+
import { Stars } from "../_components/stars";
1718
import { GITHUB_REPO_URL, PROJECT_URL } from "../_constants/project";
1819
import { metadataSEO } from "../metadata";
1920

@@ -51,7 +52,9 @@ export default async function RootLayout({ children, params }) {
5152
</>
5253
}
5354
projectLink={PROJECT_URL}
54-
projectIcon={<GitHubIcon className="w-6 h-6" aria-label="Github" />}
55+
projectIcon={
56+
<Stars variant="small" />
57+
}
5558
chatLink="https://ddias.link/discord"
5659
chatIcon={<DiscordIcon className="w-6 h-6" aria-label="Discord" />}
5760
>

app/_components/stars.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import { StarIcon } from 'lucide-react';
66
import { GitHubIcon } from 'nextra/icons';
77
import { useEffect, useState } from 'react';
88

9-
export function Stars() {
9+
type StarsProps = {
10+
variant?: 'default' | 'small'
11+
}
12+
13+
export const Stars = ({ variant = 'default' }: StarsProps) => {
1014
const [stars, setStars] = useState<number | null>(null)
1115

1216
useEffect(() => {
@@ -27,11 +31,12 @@ export function Stars() {
2731
target="_blank"
2832
rel="noopener noreferrer"
2933
className="!no-underline plausible-event-name=Star+Github inline-flex items-center gap-2 px-4 py-2 bg-white dark:bg-neutral-900 hover:bg-neutral-100 dark:hover:bg-neutral-800 text-sm font-medium text-neutral-900 dark:text-neutral-100 rounded-lg border border-neutral-400 dark:border-neutral-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-200 dark:focus:ring-neutral-700"
34+
aria-label="Star on GitHub"
3035
>
31-
<GitHubIcon className="w-4 h-4" />
32-
<span className="hidden lg:inline">Star on GitHub</span>
36+
<GitHubIcon className="w-4 h-4" aria-hidden="true" />
37+
{variant === 'default' && <span className="hidden lg:inline">Star on GitHub</span>}
3338
<span className="inline-flex items-center px-2 py-0.5 rounded bg-neutral-100 dark:bg-neutral-700 text-neutral-900 dark:text-neutral-100">
34-
<StarIcon className="w-4 h-4 mr-1" />
39+
<StarIcon className="w-4 h-4 mr-1" aria-hidden="true" />
3540
{stars}
3641
</span>
3742
</a>

0 commit comments

Comments
 (0)