From ad265a4d209cab12546966328cb90fb38e885766 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Mon, 25 Mar 2024 15:38:42 +0800 Subject: [PATCH] theme-game loading & animate --- .../game/components/GameListIndexCombine.js | 25 ++++++++++++++----- themes/game/index.js | 6 +++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/themes/game/components/GameListIndexCombine.js b/themes/game/components/GameListIndexCombine.js index 2de16df6..846b203e 100644 --- a/themes/game/components/GameListIndexCombine.js +++ b/themes/game/components/GameListIndexCombine.js @@ -37,8 +37,14 @@ export const GameListIndexCombine = ({ posts }) => { // 试图将4合一卡组塞满 while (gamesClone?.length > 0 && groupItems.length < 4) { const item = gamesClone.shift() - if (item.tags?.some(t => t === siteConfig('GAME_RECOMMEND_TAG', 'Recommend', CONFIG))) { - components.push() + if ( + item.tags?.some( + t => t === siteConfig('GAME_RECOMMEND_TAG', 'Recommend', CONFIG) + ) + ) { + components.push( + + ) continue } else { groupItems.push(item) @@ -53,7 +59,9 @@ export const GameListIndexCombine = ({ posts }) => { // 剩余的4合一不满4个的给他放大卡 while (groupItems.length > 0) { const item = groupItems.shift() - components.push() + components.push( + + ) } } } @@ -107,7 +115,9 @@ const GameAd = () => { */ const GameItemGroup = ({ items }) => { return ( -
+
{items.map((item, index) => ( ))} @@ -124,7 +134,9 @@ const GameItem = ({ item, isLargeCard }) => { const { title } = item const img = item.pageCoverThumbnail const [showType, setShowType] = useState('img') // img or video - const url = checkContainHttp(item.slug) ? sliceUrlFromHttp(item.slug) : `${siteConfig('SUB_PATH', '')}/${item.slug}` + const url = checkContainHttp(item.slug) + ? sliceUrlFromHttp(item.slug) + : `${siteConfig('SUB_PATH', '')}/${item.slug}` const video = item?.ext?.video return ( { setShowType('img') }} title={title} - className={`card-single ${ + data-wow-delay='.2s' + className={`wow fadeInUp card-single ${ isLargeCard ? 'h-[20rem]' : 'h-full' } w-full relative shadow rounded-md overflow-hidden flex justify-center items-center group hover:border-purple-400`}> diff --git a/themes/game/index.js b/themes/game/index.js index ccc9c3c7..4812f007 100644 --- a/themes/game/index.js +++ b/themes/game/index.js @@ -6,6 +6,7 @@ import replaceSearchResult from '@/components/Mark' import NotionPage from '@/components/NotionPage' import ShareBar from '@/components/ShareBar' import { siteConfig } from '@/lib/config' +import { loadWowJS } from '@/lib/plugins/wow' import { deepClone, isBrowser, shuffleArray } from '@/lib/utils' import Link from 'next/link' import { createContext, useContext, useEffect, useRef, useState } from 'react' @@ -69,6 +70,7 @@ const LayoutBase = props => { ? JSON.parse(localStorage.getItem('recent_games')) : [] ) + loadWowJS() }, []) return ( @@ -306,7 +308,7 @@ const LayoutSlug = props => { // 定义一个函数来处理iframe加载成功事件 function iframeLoaded() { if (game) { - setLoading(false) + // setLoading(false) } } @@ -371,7 +373,7 @@ const LayoutSlug = props => { {loading && (
-

+

{siteConfig('TITLE')}