optimize icon width by url

This commit is contained in:
emengweb
2023-10-18 11:29:02 +08:00
parent bfb2a17b8f
commit 5f782d8314
2 changed files with 4 additions and 2 deletions

View File

@@ -7,11 +7,12 @@ import React from 'react'
const BlogPostCard = ({ post, className }) => {
const router = useRouter()
const currentSelected = router.asPath.split('?')[0] === '/' + post.slug
const pageIcon = post.pageIcon.startsWith("http") ? post.pageIcon+"&width=88" : post.pageIcon
return (
<Link href={`${removeHttp(post.slug)}`} target={(checkRemoveHttp(post.slug) ? '_blank' : '_self')} passHref>
<div key={post.id} className={`${className} h-full rounded-lg p-4 dark:bg-neutral-800 cursor-pointer bg-white hover:bg-white rounded-2xl dark:hover:bg-gray-800 ${currentSelected ? 'bg-green-50 text-green-500' : ''}`}>
<div className="stack-entry w-full flex space-x-3 select-none dark:text-neutral-200">
<NotionIcon icon={post.pageIcon} size='10' className='text-6xl w-11 h-11 mx-1 my-0 flex-none' />
<NotionIcon icon={pageIcon} size='10' className='text-6xl w-11 h-11 mx-1 my-0 flex-none' />
<div className="stack-comment flex-auto">
<p className="title font-bold">{post.title}</p>
<p className="description font-normal">{post.summary ? post.summary : '暂无简介'}</p>

View File

@@ -12,6 +12,7 @@ import CONFIG from '../config'
export default function LogoBar(props) {
const { siteInfo } = props
const { pageNavVisible, changePageNavVisible } = useNavGlobal()
// const logo = siteInfo?.icon?.replaceAll("width=400", "width=280")
const togglePageNavVisible = () => {
changePageNavVisible(!pageNavVisible)
@@ -23,7 +24,7 @@ export default function LogoBar(props) {
</div> */}
<div className='md:w-48'>
<a href='/' className='grid justify-items-center text-md md:text-xl dark:text-gray-200'>
<LazyImage src={siteInfo?.icon} height='44px' alt={BLOG.AUTHOR} className='md:block' placeholderSrc=''/>
<LazyImage src={siteInfo?.icon?.replaceAll("width=400", "width=280")} height='44px' alt={BLOG.AUTHOR + ' - ' + BLOG.NEXT_PUBLIC_BIO} className='md:block' placeholderSrc=''/>
{CONFIG.SHOW_TITLE_TEXT && siteInfo?.title}
</a>
</div>