Skip to content

Commit

Permalink
starter主题-Logo相关
Browse files Browse the repository at this point in the history
  • Loading branch information
tangly1024 committed Nov 9, 2024
1 parent c2d9324 commit 47b8d97
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion components/LazyImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default function LazyImage({
height,
title,
onLoad,
onClick,
style
}) {
const maxWidth = siteConfig('IMAGE_COMPRESS_WIDTH')
Expand Down Expand Up @@ -122,7 +123,9 @@ export default function LazyImage({
if (style) {
imgProps.style = style
}

if (onClick) {
imgProps.onClick = onClick
}
return (
<>
{/* eslint-disable-next-line @next/next/no-img-element */}
Expand Down
7 changes: 4 additions & 3 deletions themes/starter/components/Logo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable @next/next/no-img-element */
/* eslint-disable @next/next/no-html-link-for-pages */
import LazyImage from '@/components/LazyImage'
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
import throttle from 'lodash.throttle'
Expand Down Expand Up @@ -48,14 +49,14 @@ export const Logo = props => {
<div className='navbar-logo flex items-center w-full py-5 cursor-pointer'>
{/* eslint-disable-next-line @next/next/no-img-element */}
{logo && (
<img
<LazyImage
priority
onClick={() => {
router.push('/')
}}
src={logo}
height={14}
alt='logo'
className='header-logo w-full mr-1'
className='header-logo mr-1 h-8'
/>
)}
{/* logo文字 */}
Expand Down

0 comments on commit 47b8d97

Please sign in to comment.