Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Apr 25, 2024
2 parents 04d24b3 + 939515b commit 9c8a83c
Show file tree
Hide file tree
Showing 4 changed files with 337 additions and 250 deletions.
19 changes: 13 additions & 6 deletions themes/matery/components/BlogPostListPage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import BlogPostCard from './BlogPostCard'
import { siteConfig } from '@/lib/config'
import BlogPostCard from './BlogPostCard'
import BlogPostListEmpty from './BlogPostListEmpty'
import PaginationSimple from './PaginationSimple'

Expand All @@ -12,7 +12,9 @@ import PaginationSimple from './PaginationSimple'
* @constructor
*/
const BlogPostListPage = ({ page = 1, posts = [], postCount, siteInfo }) => {
const totalPage = Math.ceil(postCount / parseInt(siteConfig('POSTS_PER_PAGE')))
const totalPage = Math.ceil(
postCount / parseInt(siteConfig('POSTS_PER_PAGE'))
)
const showPagination = postCount >= parseInt(siteConfig('POSTS_PER_PAGE'))
if (!posts || posts.length === 0 || page > totalPage) {
return <BlogPostListEmpty />
Expand All @@ -21,12 +23,17 @@ const BlogPostListPage = ({ page = 1, posts = [], postCount, siteInfo }) => {
<div className='w-full'>
<div className='pt-6'></div>
{/* 文章列表 */}
<div className="pt-4 flex flex-wrap pb-12" >
{posts?.map(post => (
<div key={post.id} className='xl:w-1/3 md:w-1/2 w-full p-4'> <BlogPostCard index={posts.indexOf(post)} post={post} siteInfo={siteInfo} /></div>
<div className='pt-4 flex flex-wrap pb-12'>
{posts?.map((post, index) => (
<div key={post.id} className='xl:w-1/3 md:w-1/2 w-full p-4'>
{' '}
<BlogPostCard index={index} post={post} siteInfo={siteInfo} />
</div>
))}
</div>
{showPagination && <PaginationSimple page={page} totalPage={totalPage} />}
{showPagination && (
<PaginationSimple page={page} totalPage={totalPage} />
)}
</div>
)
}
Expand Down
63 changes: 46 additions & 17 deletions themes/matery/components/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,60 @@ import { siteConfig } from '@/lib/config'
const Footer = ({ title }) => {
const d = new Date()
const currentYear = d.getFullYear()
const copyrightDate = (function() {
if (Number.isInteger(siteConfig('SINCE')) && siteConfig('SINCE') < currentYear) {
const copyrightDate = (function () {
if (
Number.isInteger(siteConfig('SINCE')) &&
siteConfig('SINCE') < currentYear
) {
return siteConfig('SINCE') + '-' + currentYear
}
return currentYear
})()

return (
<footer
className='relative z-10 dark:bg-black flex-shrink-0 bg-indigo-700 text-gray-300 justify-center text-center m-auto w-full leading-6 dark:text-gray-100 text-sm p-6'
>
<footer className='relative z-10 dark:bg-black flex-shrink-0 bg-indigo-700 text-gray-300 justify-center text-center m-auto w-full leading-6 dark:text-gray-100 text-sm p-6'>
{/* <DarkModeButton/> */}

<i className='fas fa-copyright' /> {`${copyrightDate}`} <span><i className='mx-1 animate-pulse fas fa-heart'/> <a href={siteConfig('LINK')} className='underline font-bold dark:text-gray-300 '>{siteConfig('AUTHOR')}</a>.<br/>

{siteConfig('BEI_AN') && <><i className='fas fa-shield-alt' /> <a href='https://beian.miit.gov.cn/' className='mr-2'>{siteConfig('BEI_AN')}</a><br/></>}

<span className='hidden busuanzi_container_site_pv'>
<i className='fas fa-eye'/><span className='px-1 busuanzi_value_site_pv'> </span> </span>
<span className='pl-2 hidden busuanzi_container_site_uv'>
<i className='fas fa-users'/> <span className='px-1 busuanzi_value_site_uv'> </span> </span>
<br/>
<i className='fas fa-copyright' /> {`${copyrightDate}`}{' '}
<span>
<span className='w-5 mx-1 text-center'>
<i className=' animate-pulse fas fa-heart' />
</span>{' '}
<a
href={siteConfig('LINK')}
className='underline font-bold dark:text-gray-300 '>
{siteConfig('AUTHOR')}
</a>
.<br />
{siteConfig('BEI_AN') && (
<>
<i className='fas fa-shield-alt' />{' '}
<a href='https://beian.miit.gov.cn/' className='mr-2'>
{siteConfig('BEI_AN')}
</a>
<br />
</>
)}
<span className='hidden busuanzi_container_site_pv'>
<i className='fas fa-eye' />
<span className='px-1 busuanzi_value_site_pv'> </span>{' '}
</span>
<span className='pl-2 hidden busuanzi_container_site_uv'>
<i className='fas fa-users' />{' '}
<span className='px-1 busuanzi_value_site_uv'> </span>{' '}
</span>
<br />
<h1>{title}</h1>
<span className='text-xs '>Powered by <a href='https://github.com/tangly1024/NotionNext' className='underline dark:text-gray-300'>NotionNext {siteConfig('VERSION')}</a>.</span></span><br/>

<span className='text-xs '>
Powered by{' '}
<a
href='https://github.com/tangly1024/NotionNext'
className='underline dark:text-gray-300'>
NotionNext {siteConfig('VERSION')}
</a>
.
</span>
</span>
<br />
</footer>
)
}
Expand Down
28 changes: 20 additions & 8 deletions themes/matery/components/PostHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,27 @@ import { siteConfig } from '@/lib/config'
* 文章背景图
*/
export default function PostHeader({ post, siteInfo }) {
const headerImage = post?.pageCoverThumbnail ? post?.pageCoverThumbnail : siteInfo?.pageCover
const headerImage = post?.pageCoverThumbnail
? post?.pageCoverThumbnail
: siteInfo?.pageCover
const title = post?.title
return (
<div id='header' className="flex h-96 justify-center align-middle items-center w-full relative bg-black">
<div className="z-10 leading-snug font-bold xs:text-4xl sm:text-4xl md:text-5xl md:leading-snug text-4xl shadow-text-md flex justify-center text-center text-white">
{siteConfig('POST_TITLE_ICON') && <NotionIcon icon={post?.pageIcon} />}{title}
</div>
<LazyImage alt={title} src={headerImage} className='pointer-events-none select-none w-full h-full object-cover opacity-30 absolute'
placeholder='blur' blurDataURL='/bg_image.jpg' />
</div>
<div
id='header'
className='flex h-96 justify-center align-middle items-center w-full relative bg-black'>
<div
data-wow-delay='.1s'
className='wow fadeInUp z-10 leading-snug font-bold xs:text-4xl sm:text-4xl md:text-5xl md:leading-snug text-4xl shadow-text-md flex justify-center text-center text-white'>
{siteConfig('POST_TITLE_ICON') && <NotionIcon icon={post?.pageIcon} />}
{title}
</div>
<LazyImage
alt={title}
src={headerImage}
className='pointer-events-none select-none w-full h-full object-cover opacity-30 absolute'
placeholder='blur'
blurDataURL={siteConfig('IMG_LAZY_LOAD_PLACEHOLDER')}
/>
</div>
)
}
Loading

0 comments on commit 9c8a83c

Please sign in to comment.