diff --git a/public/images/themes-preview/photo.png b/public/images/themes-preview/photo.png new file mode 100644 index 00000000..f196fcae Binary files /dev/null and b/public/images/themes-preview/photo.png differ diff --git a/themes/photo/components/Announcement.js b/themes/photo/components/Announcement.js index 1f265417..38b701a5 100644 --- a/themes/photo/components/Announcement.js +++ b/themes/photo/components/Announcement.js @@ -1,22 +1,23 @@ -import { useGlobal } from '@/lib/global' import dynamic from 'next/dynamic' const NotionPage = dynamic(() => import('@/components/NotionPage')) - -const Announcement = ({ post, className }) => { - const { locale } = useGlobal() - if (!post || Object.keys(post).length === 0) { +/** + * 公告 + * @param {*} param0 + * @returns + */ +const Announcement = ({ notice, className }) => { + if (!notice || Object.keys(notice).length === 0) { return <>> } - return + return ( + + ) } export default Announcement diff --git a/themes/photo/components/Swiper.js b/themes/photo/components/Swiper.js index 381e00c8..6917c465 100644 --- a/themes/photo/components/Swiper.js +++ b/themes/photo/components/Swiper.js @@ -1,6 +1,11 @@ import { useEffect, useRef, useState } from 'react' import PostItemCard from './PostItemCard' +/** + * 滑动走马灯 + * @param {*} param0 + * @returns + */ const InertiaCarousel = ({ posts }) => { const carouselRef = useRef(null) const [isDragging, setIsDragging] = useState(false) @@ -14,7 +19,7 @@ const InertiaCarousel = ({ posts }) => { const startDrag = e => { e.preventDefault() setIsDragging(true) - const startPosition = e.pageX || e.touches[0].pageX + const startPosition = e.pageX || e.touches?.[0].pageX setStartX(startPosition - carouselRef.current.offsetLeft) setScrollLeft(carouselRef.current.scrollLeft) setLastX(startPosition) // 初始化上一次的位置 @@ -72,7 +77,7 @@ const InertiaCarousel = ({ posts }) => { return (