mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 16:51:37 +00:00
fix hydration error
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import useMounted from 'lib/hooks/use-mounted';
|
||||||
import { useTheme } from 'next-themes';
|
import { useTheme } from 'next-themes';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
@ -8,16 +9,27 @@ const PostCommnetLine = () => {
|
|||||||
const { systemTheme, theme } = useTheme();
|
const { systemTheme, theme } = useTheme();
|
||||||
const currentTheme = theme === 'system' ? systemTheme : theme;
|
const currentTheme = theme === 'system' ? systemTheme : theme;
|
||||||
|
|
||||||
|
const { mounted } = useMounted();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="flex justify-center select-none">
|
<div className="flex justify-center select-none">
|
||||||
{currentTheme === 'dark' ? (
|
{mounted ? (
|
||||||
<Image
|
currentTheme === 'dark' ? (
|
||||||
src="/images/img/comment-line-dark.svg"
|
<Image
|
||||||
width={300}
|
src="/images/img/comment-line-dark.svg"
|
||||||
height={150}
|
width={300}
|
||||||
alt=""
|
height={150}
|
||||||
/>
|
alt=""
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Image
|
||||||
|
src="/images/img/comment-line.svg"
|
||||||
|
width={300}
|
||||||
|
height={150}
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
)
|
||||||
) : (
|
) : (
|
||||||
<Image
|
<Image
|
||||||
src="/images/img/comment-line.svg"
|
src="/images/img/comment-line.svg"
|
||||||
|
Reference in New Issue
Block a user