mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-25 21:56:08 +00:00
119 lines
2.8 KiB
TypeScript
119 lines
2.8 KiB
TypeScript
import type { Metadata, Viewport } from "next"
|
|
import { GeistMono } from "geist/font/mono"
|
|
import { GeistSans } from "geist/font/sans"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
import { Analytics } from "@/components/analytics"
|
|
import { ThemeProvider } from "@/components/theme-provider"
|
|
import { Toaster } from "@/registry/new-york-v4/ui/sonner"
|
|
import { siteConfig } from "@/www/config/site"
|
|
|
|
import "./globals.css"
|
|
|
|
const fontSans = GeistSans
|
|
|
|
const fontMono = GeistMono
|
|
|
|
const META_THEME_COLORS = {
|
|
light: "#ffffff",
|
|
dark: "#09090b",
|
|
}
|
|
|
|
export const metadata: Metadata = {
|
|
title: {
|
|
default: siteConfig.name,
|
|
template: `%s - ${siteConfig.name}`,
|
|
},
|
|
metadataBase: new URL(siteConfig.url),
|
|
description: siteConfig.description,
|
|
keywords: [
|
|
"Next.js",
|
|
"React",
|
|
"Tailwind CSS",
|
|
"Server Components",
|
|
"Radix UI",
|
|
],
|
|
authors: [
|
|
{
|
|
name: "shadcn",
|
|
url: "https://shadcn.com",
|
|
},
|
|
],
|
|
creator: "shadcn",
|
|
openGraph: {
|
|
type: "website",
|
|
locale: "en_US",
|
|
url: siteConfig.url,
|
|
title: siteConfig.name,
|
|
description: siteConfig.description,
|
|
siteName: siteConfig.name,
|
|
images: [
|
|
{
|
|
url: siteConfig.ogImage,
|
|
width: 1200,
|
|
height: 630,
|
|
alt: siteConfig.name,
|
|
},
|
|
],
|
|
},
|
|
twitter: {
|
|
card: "summary_large_image",
|
|
title: siteConfig.name,
|
|
description: siteConfig.description,
|
|
images: [siteConfig.ogImage],
|
|
creator: "@shadcn",
|
|
},
|
|
icons: {
|
|
icon: "/favicon.ico",
|
|
shortcut: "/favicon-16x16.png",
|
|
apple: "/apple-touch-icon.png",
|
|
},
|
|
manifest: `${siteConfig.url}/site.webmanifest`,
|
|
}
|
|
|
|
export const viewport: Viewport = {
|
|
themeColor: META_THEME_COLORS.light,
|
|
}
|
|
|
|
export default function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode
|
|
}>) {
|
|
return (
|
|
<html lang="en" suppressHydrationWarning>
|
|
<head>
|
|
<script
|
|
dangerouslySetInnerHTML={{
|
|
__html: `
|
|
try {
|
|
if (localStorage.theme === 'dark' || ((!('theme' in localStorage) || localStorage.theme === 'system') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
|
document.querySelector('meta[name="theme-color"]').setAttribute('content', '${META_THEME_COLORS.dark}')
|
|
}
|
|
} catch (_) {}
|
|
`,
|
|
}}
|
|
/>
|
|
</head>
|
|
<body
|
|
className={cn(
|
|
"bg-background min-h-svh overscroll-none font-sans antialiased",
|
|
fontSans.variable,
|
|
fontMono.variable
|
|
)}
|
|
>
|
|
<ThemeProvider
|
|
attribute="class"
|
|
defaultTheme="system"
|
|
enableSystem
|
|
disableTransitionOnChange
|
|
>
|
|
{children}
|
|
<Toaster />
|
|
<Analytics />
|
|
</ThemeProvider>
|
|
</body>
|
|
</html>
|
|
)
|
|
}
|