mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-02-26 05:54:42 +08:00
feat: dynamic site name
This commit is contained in:
21
src/components/SiteProvider.tsx
Normal file
21
src/components/SiteProvider.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
'use client';
|
||||
|
||||
import { createContext, ReactNode, useContext } from 'react';
|
||||
|
||||
const SiteContext = createContext<{ siteName: string }>({
|
||||
siteName: 'MoonTV', // Default value
|
||||
});
|
||||
|
||||
export const useSite = () => useContext(SiteContext);
|
||||
|
||||
export function SiteProvider({
|
||||
children,
|
||||
siteName,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
siteName: string;
|
||||
}) {
|
||||
return (
|
||||
<SiteContext.Provider value={{ siteName }}>{children}</SiteContext.Provider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user