slug调整 兼容game主题

This commit is contained in:
tangly1024.com
2024-05-08 15:35:57 +08:00
parent ff9d211a0a
commit d3efac6074
5 changed files with 25 additions and 19 deletions

View File

@@ -2,7 +2,7 @@
import { AdSlot } from '@/components/GoogleAdsense'
import LazyImage from '@/components/LazyImage'
import { siteConfig } from '@/lib/config'
import { checkContainHttp, deepClone, sliceUrlFromHttp } from '@/lib/utils'
import { deepClone } from '@/lib/utils'
import Link from 'next/link'
import { useState } from 'react'
import CONFIG from '../config'
@@ -139,14 +139,12 @@ 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 video = item?.ext?.video
return (
<Link
title={title}
href={`${url}`}
href={`${item?.href}`}
className={`card-single ${isLargeCard ? 'h-80 ' : 'h-full text-xs'} w-full transition-all duration-200 shadow-md md:hover:scale-105 md:hover:shadow-lg relative rounded-lg overflow-hidden flex justify-center items-center
group hover:border-purple-400`}
onMouseOver={() => {

View File

@@ -1,6 +1,5 @@
/* eslint-disable @next/next/no-img-element */
import { siteConfig } from '@/lib/config'
import { checkContainHttp, deepClone, sliceUrlFromHttp } from '@/lib/utils'
import { deepClone } from '@/lib/utils'
import Link from 'next/link'
import { useState } from 'react'
@@ -43,12 +42,11 @@ const GameItem = ({ item }) => {
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 video = item?.ext?.video
return (
<Link
href={`${url}`}
href={`${item?.href}`}
onMouseOver={() => {
setShowType('video')
}}
@@ -58,17 +56,27 @@ const GameItem = ({ item }) => {
title={title}
className={`card-single h-28 w-28 relative shadow rounded-md overflow-hidden flex justify-center items-center
group hover:border-purple-400`}>
<div className='absolute text-sm bottom-2 transition-all duration-200 text-white z-30'>{title}</div>
<div className='absolute text-sm bottom-2 transition-all duration-200 text-white z-30'>
{title}
</div>
<div className='h-1/2 w-full absolute left-0 bottom-0 z-20 opacity-75 transition-all duration-200'>
<div className='h-full w-full absolute bg-gradient-to-b from-transparent to-black'></div>
</div>
{showType === 'video' && (
<video className='z-10 object-cover w-auto h-28 absolute overflow-hidden' loop='true' autoPlay preload='none'>
<video
className='z-10 object-cover w-auto h-28 absolute overflow-hidden'
loop='true'
autoPlay
preload='none'>
<source src={video} type='video/mp4' />
</video>
)}
<img className='w-full h-full absolute object-cover' src={img} alt={title} />
<img
className='w-full h-full absolute object-cover'
src={img}
alt={title}
/>
</Link>
)
}

View File

@@ -33,7 +33,7 @@ export const MenuItemCollapse = props => {
onClick={toggleShow}>
{!hasSubMenu && (
<Link
href={link?.to}
href={link?.href}
target={link?.target}
className='font-extralight flex justify-between pl-2 pr-4 dark:text-gray-200 no-underline tracking-widest pb-1'>
<span className=' hover:text-red-400 transition-all items-center duration-200'>
@@ -71,7 +71,7 @@ export const MenuItemCollapse = props => {
<div
key={index}
className='font-extralight dark:bg-black text-left px-10 justify-start bg-gray-50 hover:bg-gray-50 dark:hover:bg-gray-900 tracking-widest transition-all duration-200 border-b dark:border-gray-800 py-3 pr-6'>
<Link href={sLink.to} target={link?.target}>
<Link href={sLink.href} target={link?.target}>
<span className='text-xs'>{sLink.title}</span>
</Link>
</div>

View File

@@ -18,7 +18,7 @@ export const MenuItemDrop = ({ link }) => {
{!hasSubMenu && (
<div className='dark:text-gray-50 nav hover:scale-105 transition-transform duration-200'>
<Link
href={link?.to}
href={link?.href}
className='flex flex-nowrap'
target={link?.target}>
<div className='w-6 mr-2 text-center'>
@@ -47,7 +47,7 @@ export const MenuItemDrop = ({ link }) => {
<div
key={index}
className='text-gray-700 dark:text-gray-200 tracking-widest transition-all duration-200 '>
<Link href={sLink.to} target={link?.target}>
<Link href={sLink.href} target={link?.target}>
<span className='text-sm text-nowrap font-extralight'>
{link?.icon && <i className={sLink?.icon}> &nbsp; </i>}
{sLink.title}

View File

@@ -17,21 +17,21 @@ export const MenuList = props => {
id: 1,
icon: 'fas fa-home',
name: locale.NAV.INDEX,
to: '/' || '/',
href: '/' || '/',
show: true
},
{
id: 2,
icon: 'fas fa-th',
name: locale.COMMON.CATEGORY,
to: '/category',
href: '/category',
show: siteConfig('GAME_MENU_CATEGORY', null, CONFIG)
},
{
id: 3,
icon: 'fas fa-tag',
name: locale.COMMON.TAGS,
to: '/tag',
href: '/tag',
show: siteConfig('GAME_MENU_TAG', null, CONFIG)
}
]