Next主题 SEO

This commit is contained in:
tangly1024.com
2024-01-31 18:45:11 +08:00
parent eced20bfe7
commit 765ba1cb25
21 changed files with 88 additions and 89 deletions

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useImperativeHandle } from 'react'
import { useEffect, useImperativeHandle, useRef } from 'react'
/**
* 折叠面板组件,支持水平折叠、垂直折叠
@@ -7,7 +7,7 @@ import React, { useEffect, useImperativeHandle } from 'react'
*/
const Collapse = props => {
const { collapseRef } = props
const ref = React.useRef(null)
const ref = useRef(null)
const type = props.type || 'vertical'
useImperativeHandle(collapseRef, () => {
@@ -17,8 +17,10 @@ const Collapse = props => {
* @param {*} param0
*/
updateCollapseHeight: ({ height, increase }) => {
ref.current.style.height = ref.current.scrollHeight
ref.current.style.height = 'auto'
if (props.isOpen) {
ref.current.style.height = ref.current.scrollHeight
ref.current.style.height = 'auto'
}
}
}
})

View File

@@ -1,7 +1,7 @@
/* eslint-disable no-undef */
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
import { loadExternalResource } from '@/lib/utils'
import { isMobile, loadExternalResource } from '@/lib/utils'
import { useEffect } from 'react'
/**
@@ -14,7 +14,7 @@ export default function Live2D() {
const petLink = siteConfig('WIDGET_PET_LINK')
useEffect(() => {
if (showPet) {
if (showPet && !isMobile()) {
Promise.all([
loadExternalResource('https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/live2d.min.js', 'js')
]).then((e) => {

View File

@@ -47,7 +47,8 @@ const ThemeSwitch = () => {
<div className="text-sm flex items-center group-hover:w-32 transition-all duration-200">
<i className="fa-solid fa-language w-5" />
<div className='w-0 group-hover:w-24 transition-all duration-200 overflow-hidden'>
<select value={lang} onChange={onLangSelectChange} name="themes" className='pl-1 bg-gray-50 dark:bg-black appearance-none outline-none dark:text-white uppercase cursor-pointer'>
<label htmlFor="langSelect" className="sr-only">选择语言</label>
<select id="langSelect" value={lang} onChange={onLangSelectChange} name="themes" className='pl-1 bg-gray-50 dark:bg-black appearance-none outline-none dark:text-white uppercase cursor-pointer'>
{Object.keys(LANGS)?.map(t => {
return <option key={t} value={t}>{LANGS[t].LOCALE}</option>
})}
@@ -59,7 +60,8 @@ const ThemeSwitch = () => {
<div className="text-sm flex items-center group-hover:w-32 transition-all duration-200">
<i className="fa-solid fa-palette w-5" />
<div className='w-0 group-hover:w-24 transition-all duration-200 overflow-hidden'>
<select value={currentTheme} onChange={onThemeSelectChange} name="themes" className='pl-1 bg-gray-50 dark:bg-black appearance-none outline-none dark:text-white uppercase cursor-pointer'>
<label htmlFor="themeSelect" className="sr-only">选择主题</label>
<select id="themeSelect" value={currentTheme} onChange={onThemeSelectChange} name="themes" className='pl-1 bg-gray-50 dark:bg-black appearance-none outline-none dark:text-white uppercase cursor-pointer'>
{THEMES?.map(t => {
return <option key={t} value={t}>{t}</option>
})}

View File

@@ -7,13 +7,13 @@ import { siteConfig } from '@/lib/config'
* @returns {JSX.Element | null} - 返回渲染的 JSX 元素或 null
*/
export default function WWAds({ orientation = 'vertical', sticky = false, className }) {
const adWWADSId = siteConfig('AD_WWADS_ID')
const AD_WWADS_ID = siteConfig('AD_WWADS_ID')
if (!adWWADSId) {
if (!AD_WWADS_ID) {
return null
}
return <div data-id={adWWADSId} className={`wwads-cn
return <div data-id={AD_WWADS_ID} className={`wwads-cn
${orientation === 'vertical' ? 'wwads-vertical' : 'wwads-horizontal'}
${sticky ? 'wwads-sticky' : ''} z-10 ${className || ''}`} />
}