部分公共组件配置化

This commit is contained in:
tangly1024.com
2023-11-08 19:05:35 +08:00
parent f96aa2242f
commit b2759c6d5e
34 changed files with 301 additions and 239 deletions

View File

@@ -1,4 +1,4 @@
import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import Head from 'next/head'
import React, { useEffect, useRef, useState } from 'react'
@@ -12,7 +12,7 @@ export default function LazyImage({
id,
src,
alt,
placeholderSrc = BLOG.IMG_LAZY_LOAD_PLACEHOLDER,
placeholderSrc,
className,
width,
height,
@@ -22,6 +22,9 @@ export default function LazyImage({
}) {
const imageRef = useRef(null)
const [imageLoaded, setImageLoaded] = useState(false)
if (!placeholderSrc) {
placeholderSrc = siteConfig('IMG_LAZY_LOAD_PLACEHOLDER')
}
const handleImageLoad = () => {
setImageLoaded(true)