主题支持title icon

This commit is contained in:
tangly1024.com
2024-02-05 18:02:56 +08:00
parent a45320d1af
commit 77a367d175
3 changed files with 3 additions and 4 deletions

View File

@@ -10,7 +10,6 @@ export const Title = (props) => {
const { post } = props const { post } = props
const title = post?.title || siteConfig('TITLE') const title = post?.title || siteConfig('TITLE')
const description = post?.description || siteConfig('AUTHOR') const description = post?.description || siteConfig('AUTHOR')
console.log('post', post)
return <div className="text-center px-6 py-12 mb-6 bg-gray-100 dark:bg-hexo-black-gray dark:border-hexo-black-gray border-b"> return <div className="text-center px-6 py-12 mb-6 bg-gray-100 dark:bg-hexo-black-gray dark:border-hexo-black-gray border-b">
<h1 className="text-xl md:text-4xl pb-4"><NotionIcon icon={post?.pageIcon} />{title}</h1> <h1 className="text-xl md:text-4xl pb-4"><NotionIcon icon={post?.pageIcon} />{title}</h1>

View File

@@ -2,6 +2,7 @@ import { siteConfig } from '@/lib/config'
import Link from 'next/link' import Link from 'next/link'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils'
import NotionIcon from '@/components/NotionIcon'
const BlogPostCard = ({ post, className }) => { const BlogPostCard = ({ post, className }) => {
const router = useRouter() const router = useRouter()
@@ -9,8 +10,8 @@ const BlogPostCard = ({ post, className }) => {
const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}` const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}`
return ( return (
<Link href={url} passHref> <div key={post.id} className={`${className} py-1.5 cursor-pointer px-1.5 hover:bg-gray-50 rounded-md dark:hover:bg-gray-600 ${currentSelected ? 'bg-green-50 text-green-500' : ''}`}> <Link href={url} passHref> <div key={post.id} className={`${className} py-1.5 cursor-pointer px-1.5 hover:bg-gray-50 rounded-md dark:hover:bg-gray-600 ${currentSelected ? 'bg-green-50 text-green-500' : ''}`}>
<div className="flex flex-col w-full select-none"> <div className="w-full select-none">
{post.title} <NotionIcon icon={post?.pageIcon}/> {post.title}
</div> </div>
</div> </div>
</Link> </Link>

View File

@@ -11,7 +11,6 @@ export const MenuItemDrop = ({ link }) => {
} }
const hasSubMenu = link?.subMenus?.length > 0 const hasSubMenu = link?.subMenus?.length > 0
const selected = (router.pathname === link.to) || (router.asPath === link.to) const selected = (router.pathname === link.to) || (router.asPath === link.to)
console.log('link', link?.to)
return <li className='cursor-pointer list-none items-center flex mx-2' onMouseOver={() => changeShow(true)} onMouseOut={() => changeShow(false)} > return <li className='cursor-pointer list-none items-center flex mx-2' onMouseOver={() => changeShow(true)} onMouseOut={() => changeShow(false)} >
{hasSubMenu && {hasSubMenu &&