Skip to content

Commit 49dca0c

Browse files
authored
Merge branch 'main' into feat/translatable-labels
2 parents bca54db + eec59db commit 49dca0c

11 files changed

Lines changed: 113 additions & 85 deletions

File tree

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"title": "Inputs",
33
"icon": "TextCursorInput",
4-
"pages": ["phone-input"],
5-
"collapsible": false
4+
"pages": ["phone-input"]
65
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"title": "Language Switchers",
33
"icon": "Globe",
4-
"pages": ["language-switcher", "language-switcher-pill"],
5-
"collapsible": false
4+
"pages": ["language-switcher", "language-switcher-pill"]
65
}

‎content/docs/components/meta.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
22
"title": "Components",
3-
"pages": ["language-switchers", "navigation", "inputs", "translation"],
4-
"collapsible": false
3+
"pages": ["index", "language-switchers", "navigation", "inputs", "translation"]
54
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"title": "Navigation",
3-
"icon": "Menu",
4-
"pages": ["navbar"],
5-
"collapsible": false
3+
"icon": "PanelTop",
4+
"pages": ["navbar"]
65
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
2-
"title": "Translation",
2+
"title": "Widgets",
33
"icon": "Languages",
4-
"pages": ["translation-widget"],
5-
"collapsible": false
4+
"pages": ["translation-widget"]
65
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"title": "Getting Started",
3-
"pages": ["index", "install", "shadcn-cli", "contributing", "rulebook"],
4-
"collapsible": false
2+
"title": "Get Started",
3+
"pages": ["index", "install", "shadcn-cli", "contributing", "rulebook"]
54
}

‎content/docs/meta.json‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
{
2-
"pages": ["getting-started", "components", "customization"],
3-
"collapsible": false
2+
"pages": [
3+
"---Get Started---",
4+
"getting-started/index",
5+
"getting-started/install",
6+
"getting-started/shadcn-cli",
7+
"---Components---",
8+
"[LayoutGrid][Overview](/docs/components)",
9+
"components/language-switchers",
10+
"components/navigation",
11+
"components/inputs",
12+
"components/translation",
13+
"---Customization---",
14+
"customization/interfaces",
15+
"---Contributing---",
16+
"getting-started/contributing",
17+
"getting-started/rulebook"
18+
]
419
}

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@babelize/elements",
3-
"version": "1.1.2",
3+
"version": "2.0.1",
44
"description": "Open-source Localization UI components for React and Tailwind CSS.",
55
"license": "MIT",
66
"type": "module",

‎src/app/api/search/route.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { createFromSource } from "fumadocs-core/search/server";
2+
import { source } from "@/lib/source";
3+
4+
// Backs the docs search dialog (Cmd+K), which queries /api/search by default.
5+
export const { GET } = createFromSource(source);

‎src/app/docs/layout.tsx‎

Lines changed: 57 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,68 +2,73 @@ import type { ReactNode } from "react";
22
import { DocsLayout } from "fumadocs-ui/layouts/docs";
33
import { source } from "@/lib/source";
44
import { baseOptions } from "../layout.config";
5-
import { FileText, ExternalLink } from "lucide-react";
5+
import { version as localVersion } from "../../../package.json";
6+
7+
const DISCORD_PATH =
8+
"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z";
9+
const GITHUB_PATH =
10+
"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12";
11+
12+
function IconLink({ href, label, path }: { href: string; label: string; path: string }) {
13+
return (
14+
<a
15+
href={href}
16+
target="_blank"
17+
rel="noopener noreferrer"
18+
aria-label={label}
19+
title={label}
20+
className="flex size-8 items-center justify-center rounded-md text-fd-muted-foreground transition-colors hover:bg-fd-accent hover:text-fd-foreground"
21+
>
22+
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" className="size-4">
23+
<path d={path} />
24+
</svg>
25+
</a>
26+
);
27+
}
28+
29+
// Releases set the version from the git tag at publish time and never commit it back, so
30+
// package.json can lag; the latest npm release is the real current version.
31+
async function getLatestVersion() {
32+
try {
33+
const res = await fetch("https://registry.npmjs.org/@babelize/elements/latest", {
34+
next: { revalidate: 3600 },
35+
});
36+
if (!res.ok) return localVersion;
37+
const data: { version?: string } = await res.json();
38+
return data.version ?? localVersion;
39+
} catch {
40+
return localVersion;
41+
}
42+
}
43+
44+
export default async function Layout({ children }: { children: ReactNode }) {
45+
const version = await getLatestVersion();
646

7-
export default function Layout({ children }: { children: ReactNode }) {
847
return (
948
<DocsLayout
1049
tree={source.pageTree}
1150
{...baseOptions}
1251
sidebar={{
13-
banner: (
14-
<a
15-
key="llms-txt"
16-
href="/llms-full.txt"
17-
className="flex items-center gap-2 rounded-lg p-2 text-sm text-fd-muted-foreground transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground"
18-
>
19-
<FileText className="size-4" />
20-
llms-full.txt
21-
</a>
22-
),
2352
footer: (
24-
<div key="sidebar-footer" className="flex flex-col gap-1 pt-4 mt-4">
25-
<a
26-
href="https://discord.gg/Qqzr2g4KGx"
27-
target="_blank"
28-
rel="noopener noreferrer"
29-
className="group flex items-center justify-between rounded-lg p-2 text-sm text-fd-muted-foreground transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground"
30-
>
31-
<div className="flex items-center gap-2.5">
32-
<svg
33-
width="16"
34-
height="16"
35-
viewBox="0 0 24 24"
36-
fill="currentColor"
37-
aria-hidden="true"
38-
className="size-4"
39-
>
40-
<path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z" />
41-
</svg>
42-
<span>Community</span>
43-
</div>
44-
<ExternalLink className="size-3.5 opacity-50 group-hover:opacity-100" />
45-
</a>
46-
<a
53+
<div
54+
key="sidebar-footer"
55+
className="flex items-center gap-1 border-t border-fd-border pt-3"
56+
>
57+
<IconLink href="https://discord.gg/Qqzr2g4KGx" label="Community" path={DISCORD_PATH} />
58+
<IconLink
4759
href="https://github.com/babelize/babelize-elements"
48-
target="_blank"
49-
rel="noopener noreferrer"
50-
className="group flex items-center justify-between rounded-lg p-2 text-sm text-fd-muted-foreground transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground"
60+
label="GitHub"
61+
path={GITHUB_PATH}
62+
/>
63+
<a
64+
href="/llms-full.txt"
65+
className="ml-1 rounded-md border border-fd-border px-2 py-1 font-mono text-[0.6875rem] text-fd-muted-foreground transition-colors hover:border-fd-primary/40 hover:text-fd-primary"
5166
>
52-
<div className="flex items-center gap-2.5">
53-
<svg
54-
width="16"
55-
height="16"
56-
viewBox="0 0 24 24"
57-
fill="currentColor"
58-
aria-hidden="true"
59-
className="size-4"
60-
>
61-
<path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />
62-
</svg>
63-
<span>GitHub</span>
64-
</div>
65-
<ExternalLink className="size-3.5 opacity-50 group-hover:opacity-100" />
67+
llms-full.txt
6668
</a>
69+
<span className="ml-auto font-mono text-[0.6875rem] text-fd-muted-foreground/60">
70+
v{version}
71+
</span>
6772
</div>
6873
),
6974
}}

0 commit comments

Comments
 (0)