Skip to content

Commit

Permalink
little fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tangly1024 committed Jan 30, 2024
1 parent e63e82c commit 4996cfd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
7 changes: 5 additions & 2 deletions components/Utterances.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ const Utterances = ({ issueTerm, layout }) => {
const [isLoading, setLoading] = useState(true);

useEffect(() => {
const script = document.createElement('script');
const anchor = document.getElementById('comments');
if(!anchor){
return
}
const script = document.createElement('script');
script.onload = () => setLoading(false);
script.setAttribute('src', 'https://utteranc.es/client.js');
script.setAttribute('crossorigin', 'anonymous');
Expand All @@ -25,7 +28,7 @@ const Utterances = ({ issueTerm, layout }) => {
script.setAttribute('issue-term', 'title');
// 初始主题
script.setAttribute('theme', isDarkMode ? 'github-dark' : 'github-light');
anchor.appendChild(script);
anchor?.appendChild(script);

return () => {
// anchor.innerHTML = ''
Expand Down
4 changes: 0 additions & 4 deletions themes/nav/components/BlogPostItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import BlogPostCard from './BlogPostCard'
*/
const BlogPostItem = (props) => {
const { group } = props

console.log('####### group')
console.log(group)

if (group?.category) {
return <>
<div id={group?.category} className='category text-lg font-normal pt-9 pb-4 first:pt-4 select-none flex justify-between font-sans text-neutral-800 dark:text-neutral-400 p-2' key={group?.category}>
Expand Down
5 changes: 3 additions & 2 deletions themes/nav/components/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export const MenuItem = ({ link }) => {
}

// #号加标题 快速跳转到指定锚点
const url = link?.to && link?.to.length > 0 ? link.to : '#' + link?.title
const url = link?.to && link?.to !=='#' ? link.to : ('#' + link.name)
console.log(link,url , '#' + link.name)

return <>
{/* 菜单 */}
Expand Down Expand Up @@ -53,7 +54,7 @@ export const MenuItem = ({ link }) => {
{
link?.subMenus?.map((sLink, index) => {
// #号加标题 快速跳转到指定锚点
const sUrl = sLink?.to && sLink?.to.length > 0 ? sLink.to : '#' + sLink?.title
const sUrl = sLink?.to && sLink?.to.length !=='#' ? sLink.to : ('#' + sLink.name)
return <div key={index} className='nav-submenu'>
<Link href={sUrl}>
<span className='dark:text-neutral-400 text-gray-500 hover:text-black dark:hover:text-white text-xs font-bold'><i className={`text-xs mr-1 ${sLink?.icon ? sLink?.icon : 'fas fa-hashtag'}`} />{sLink.title}</span>
Expand Down
24 changes: 12 additions & 12 deletions themes/nav/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,15 @@ const LayoutPostList = props => {
// 顶部如果是按照分类或标签查看文章列表,列表顶部嵌入一个横幅
// 如果是搜索,则列表顶部嵌入 搜索框
return (
<LayoutBase {...props} >
<>
<div className='w-full max-w-7xl mx-auto justify-center mt-8'>
<div id='posts-wrapper' class='card-list grid gap-4 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5'>
{posts?.map(post => (
<BlogPostCard key={post.id} post = {post} className='card' />
))}
</div>
</div>
</LayoutBase>
</>
)
}

Expand All @@ -216,7 +216,7 @@ const LayoutSlug = (props) => {
const { post, lock, validPassword } = props

return (
<LayoutBase {...props} >
<>
{/* 文章锁 */}
{lock && <ArticleLock validPassword={validPassword} />}

Expand Down Expand Up @@ -250,7 +250,7 @@ const LayoutSlug = (props) => {

<TocDrawer {...props} />
</div>}
</LayoutBase>
</>
)
}

Expand All @@ -271,14 +271,14 @@ const LayoutSearch = (props) => {
* @returns
*/
const LayoutArchive = (props) => {
return <LayoutBase {...props}></LayoutBase>
return <div {...props}></div>
// const { archivePosts } = props

return <LayoutBase {...props}>
return <>
<div className="mb-10 pb-20 md:py-12 py-3 min-h-full">
{Object.keys(archivePosts)?.map(archiveTitle => <BlogArchiveItem key={archiveTitle} archiveTitle={archiveTitle} archivePosts={archivePosts} />)}
</div>
</LayoutBase>
</>
}

/**
Expand All @@ -296,7 +296,7 @@ const Layout404 = props => {
const LayoutCategoryIndex = (props) => {
const { categoryOptions } = props
const { locale } = useGlobal()
return <LayoutBase {...props}>
return <>
<div className='bg-white dark:bg-gray-700 py-10'>
<div className='dark:text-gray-200 mb-5'>
<i className='mr-4 fas fa-th' />{locale.COMMON.CATEGORY}:
Expand All @@ -318,18 +318,18 @@ const LayoutCategoryIndex = (props) => {
})}
</div>
</div>
</LayoutBase>
</>
}

/**
* 标签列表
*/
const LayoutTagIndex = (props) => {
return <LayoutBase {...props}></LayoutBase>
return <div {...props}></div>
// const { tagOptions } = props
// const { locale } = useGlobal()

return <LayoutBase {...props}>
return <>
<div className="bg-white dark:bg-gray-700 py-10">
<div className="dark:text-gray-200 mb-5">
<i className="mr-4 fas fa-tag" />
Expand All @@ -345,7 +345,7 @@ const LayoutTagIndex = (props) => {
})}
</div>
</div>
</LayoutBase>
</>
}

export {
Expand Down

0 comments on commit 4996cfd

Please sign in to comment.