万维广告支持

This commit is contained in:
tangly1024.com
2023-08-18 15:34:54 +08:00
parent 86c2bd636e
commit 72eb040083
8 changed files with 80 additions and 8 deletions

18
components/WWAds.js Normal file
View File

@@ -0,0 +1,18 @@
import React from 'react'
import BLOG from '@/blog.config'
/**
* 万维广告插件
* @param {string} orientation - 广告方向,可以是 'vertical' 或 'horizontal'
* @param {boolean} sticky - 是否粘性定位
* @returns {JSX.Element | null} - 返回渲染的 JSX 元素或 null
*/
export default function WWAds({ orientation = 'vertical', sticky = false, className }) {
if (!JSON.parse(BLOG.AD_WWADS_ENABLE)) {
return null
}
return (
<div className={`wwads-cn ${orientation === 'vertical' ? 'wwads-vertical' : 'wwads-horizontal'} ${sticky ? 'wwads-sticky' : ''} z-30 ${className || ''}`} data-id="265"></div>
)
}