add ThemeColor component
This commit is contained in:
1 parent
77650947fe
commit
d0e926eb9c
2 files changed
+22
No files matched your search
@@ -9,6 +9,7 @@ import Head from "next/head"
|
|||||||
import { YMetrika } from "src/components/YMetrika"
|
import { YMetrika } from "src/components/YMetrika"
|
||||||
import { GAnalytics } from "src/components/GAnalytics"
|
import { GAnalytics } from "src/components/GAnalytics"
|
||||||
import { Theme } from "@/ui/theme/Theme"
|
import { Theme } from "@/ui/theme/Theme"
|
||||||
|
import { ThemeColor } from "@/ui/ThemeColor"
|
||||||
|
|
||||||
export default class MyApp extends App {
|
export default class MyApp extends App {
|
||||||
render() {
|
render() {
|
||||||
@@ -41,6 +42,10 @@ export default class MyApp extends App {
|
|||||||
|
|
||||||
<YMetrika account={24027460} />
|
<YMetrika account={24027460} />
|
||||||
<GAnalytics account={"UA-60209057-1"} />
|
<GAnalytics account={"UA-60209057-1"} />
|
||||||
|
<ThemeColor
|
||||||
|
color="white"
|
||||||
|
darkColor="hsl(240, 10%, 10%)"
|
||||||
|
/>
|
||||||
</Head>
|
</Head>
|
||||||
<Theme>
|
<Theme>
|
||||||
<Component {...pageProps} />
|
<Component {...pageProps} />
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { useDarkTheme } from "@/hooks/useDarkTheme"
|
||||||
|
|
||||||
|
export type ThemeColorProps = {
|
||||||
|
color: string
|
||||||
|
darkColor: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ThemeColor: React.FC<ThemeColorProps> = ({ color, darkColor }) => {
|
||||||
|
const dark = useDarkTheme()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<meta
|
||||||
|
name="theme-color"
|
||||||
|
content={dark ? darkColor : color}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in new issue
Block a user