Skip to content

Commit

Permalink
new_temp
Browse files Browse the repository at this point in the history
  • Loading branch information
laye0619 committed Feb 24, 2024
1 parent 2317d2f commit 4cb317a
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 61 deletions.
4 changes: 2 additions & 2 deletions themes/heo/components/DarkModeButton.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useGlobal } from '@/lib/global'
import { saveDarkModeToCookies } from '@/themes/theme'
import { saveDarkModeToLocalStorage } from '@/themes/theme'
import { Moon, Sun } from '@/components/HeroIcons'
import { useImperativeHandle } from 'react'

Expand All @@ -24,7 +24,7 @@ const DarkModeButton = (props) => {
// 用户手动设置主题
const handleChangeDarkMode = () => {
const newStatus = !isDarkMode
saveDarkModeToCookies(newStatus)
saveDarkModeToLocalStorage(newStatus)
updateDarkMode(newStatus)
const htmlElement = document.getElementsByTagName('html')[0]
htmlElement.classList?.remove(newStatus ? 'light' : 'dark')
Expand Down
4 changes: 2 additions & 2 deletions themes/heo/components/FloatDarkModeButton.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useGlobal } from '@/lib/global'
import { saveDarkModeToCookies } from '@/themes/theme'
import { saveDarkModeToLocalStorage } from '@/themes/theme'
import CONFIG from '../config'
import { siteConfig } from '@/lib/config'

Expand All @@ -13,7 +13,7 @@ export default function FloatDarkModeButton () {
// 用户手动设置主题
const handleChangeDarkMode = () => {
const newStatus = !isDarkMode
saveDarkModeToCookies(newStatus)
saveDarkModeToLocalStorage(newStatus)
updateDarkMode(newStatus)
const htmlElement = document.getElementsByTagName('html')[0]
htmlElement.classList?.remove(newStatus ? 'light' : 'dark')
Expand Down
6 changes: 3 additions & 3 deletions themes/heo/components/InfoCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ export function InfoCard(props) {
<div className='flex justify-between'>
<div className='flex space-x-3 hover:text-black dark:hover:text-white'>
{/* 两个社交按钮 */}
{/* <div className='bg-indigo-400 p-2 rounded-full transition-colors duration-200 dark:bg-yellow-500 dark:hover:bg-black hover:bg-white'>
<div className='bg-indigo-400 p-2 rounded-full transition-colors duration-200 dark:bg-yellow-500 dark:hover:bg-black hover:bg-white'>
<Link href='/about'><GlobeAlt className={'w-6 h-6'} /></Link>
</div>
<div className='bg-indigo-400 p-2 rounded-full w-10 items-center flex justify-center transition-colors duration-200 dark:bg-yellow-500 dark:hover:bg-black hover:bg-white'>
<Link href={siteConfig('HEO_INFO_CARD_URL', null, CONFIG)}><i className='fab fa-github text-xl' />
</Link>
</div> */}
</div>
</div>
<MoreButton />
</div>
Expand Down Expand Up @@ -80,7 +80,7 @@ function MoreButton() {
return <Link href='/about'>
<div className={'group bg-indigo-400 dark:bg-yellow-500 hover:bg-white dark:hover:bg-black hover:text-black dark:hover:text-white flex items-center transition-colors duration-200 py-2 px-3 rounded-full space-x-1'}>
<ArrowRightCircle className={'group-hover:stroke-black dark:group-hover:stroke-white w-6 h-6 transition-all duration-100'} />
<div className='font-bold'>关于我</div>
<div className='font-bold'>了解更多</div>
</div>
</Link>
}
1 change: 1 addition & 0 deletions themes/heo/components/MenuGroupCard.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Link from 'next/link'
import { useGlobal } from '@/lib/global'
import CONFIG from '../config'
import { siteConfig } from '@/lib/config'

const MenuGroupCard = (props) => {
const { postCount, categoryOptions, tagOptions } = props
Expand Down
4 changes: 2 additions & 2 deletions themes/heo/components/MenuItemDrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ export const MenuItemDrop = ({ link }) => {
<Link
target={link?.to?.indexOf('http') === 0 ? '_blank' : '_self'}
href={link?.to}
className="font-sans hover:bg-black hover:bg-opacity-10 rounded-2xl flex justify-center items-center px-3 py-1 no-underline tracking-widest">
className=" hover:bg-black hover:bg-opacity-10 rounded-2xl flex justify-center items-center px-3 py-1 no-underline tracking-widest">
{link?.icon && <i className={link?.icon} />} {link?.name}
</Link>}

{/* 含子菜单的按钮 */}
{hasSubMenu && <>
<div className='cursor-pointer font-sans hover:bg-black hover:bg-opacity-10 rounded-2xl flex justify-center items-center px-3 py-1 no-underline tracking-widest'>
<div className='cursor-pointer hover:bg-black hover:bg-opacity-10 rounded-2xl flex justify-center items-center px-3 py-1 no-underline tracking-widest'>
{link?.icon && <i className={link?.icon} />} {link?.name}
</div>
</>}
Expand Down
2 changes: 2 additions & 0 deletions themes/heo/components/SideRight.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export default function SideRight(props) {
<InfoCard {...props} className='w-72' />

<div className='sticky top-20 space-y-4'>

{/* 文章页显示目录 */}
{post && post.toc && post.toc.length > 0 && (
<Card className='bg-white dark:bg-[#1e1e1e]'>
<Catalog toc={post.toc} />
Expand Down
95 changes: 49 additions & 46 deletions themes/heo/config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const CONFIG = {
HEO_HOME_BANNER_ENABLE: true,

HEO_SITE_CREATE_TIME: '2022-01-07', // 建站日期,用于计算网站运行的第几天
HEO_SITE_CREATE_TIME: '2021-09-21', // 建站日期,用于计算网站运行的第几天

// 首页顶部通知条滚动内容,如不需要可以留空 []
HEO_NOTICE_BAR: [
// { title: '欢迎来到我的博客', url: 'https://blog.tangly1024.com' },
// { title: '访问文档中心获取更多帮助', url: 'https://docs.tangly1024.com' }
{ title: '欢迎来到我的博客', url: 'https://blog.tangly1024.com' },
{ title: '访问文档中心获取更多帮助', url: 'https://docs.tangly1024.com' }
],

// 英雄区左右侧组件颠倒位置
Expand All @@ -15,17 +15,17 @@ const CONFIG = {
HEO_HERO_BODY_REVERSE: false,

// 英雄区(首页顶部大卡)
HEO_HERO_TITLE_1: '投资人生',
HEO_HERO_TITLE_2: '财务自由',
HEO_HERO_TITLE_3: 'LAYE.WANG',
HEO_HERO_TITLE_4: 'PHOTOGRAPHY',
HEO_HERO_TITLE_5: '我的摄影',
HEO_HERO_TITLE_LINK: 'https://p.laye.wang',
HEO_HERO_TITLE_1: '分享编程',
HEO_HERO_TITLE_2: '与思维认知',
HEO_HERO_TITLE_3: 'TANGLY1024.COM',
HEO_HERO_TITLE_4: '新版上线',
HEO_HERO_TITLE_5: 'NotionNext4.0 轻松定制主题',
HEO_HERO_TITLE_LINK: 'https://tangly1024.com',

// 英雄区显示三个置顶分类
HEO_HERO_CATEGORY_1: { title: '投资记录', url: '/tag/投资记录' },
HEO_HERO_CATEGORY_2: { title: '热门话题', url: '/tag/热门话题' },
HEO_HERO_CATEGORY_3: { title: '日期归档', url: '/archive' },
HEO_HERO_CATEGORY_1: { title: '必看精选', url: '/tag/必看精选' },
HEO_HERO_CATEGORY_2: { title: '热门文章', url: '/tag/热门文章' },
HEO_HERO_CATEGORY_3: { title: '实用教程', url: '/tag/实用教程' },

// 英雄区右侧推荐文章标签, 例如 [推荐] , 最多六篇文章; 若留空白'',则推荐最近更新文章
HEO_HERO_RECOMMEND_POST_TAG: '推荐',
Expand All @@ -34,74 +34,77 @@ const CONFIG = {

// 右侧个人资料卡牌欢迎语,点击可自动切换
HEO_INFOCARD_GREETINGS: [
'你好!我是...',
'🏧 投资实践者',
'📷 摄影爱好者',
'🏦 财务自由行动派'
'你好!我是',
'🔍 分享与热心帮助',
'🤝 专修交互与设计',
'🏃 脚踏实地行动派',
'🏠 智能家居小能手',
'🤖️ 数码科技爱好者',
'🧱 团队小组发动机'
],
HEO_INFO_CARD_URL: 'https://laye.wang', // 个人资料底部按钮链接
HEO_INFO_CARD_URL: 'https://github.com/tangly1024/NotionNext', // 个人资料底部按钮链接

// 用户技能图标
HEO_GROUP_ICONS: [
{
title_1: 'investment1',
img_1: '/images/laye/investment1.png',
title_1: 'AfterEffect',
img_1: '/images/heo/20239df3f66615b532ce571eac6d14ff21cf072602.webp',
color_1: '#989bf8',
title_2: 'yo1',
img_2: '/images/laye/yo1.png',
title_2: 'Sketch',
img_2: '/images/heo/2023e0ded7b724a39f12d59c3dc8fbdc7cbe074202.webp',
color_2: '#ffffff'
},
{
title_1: 'photography1',
img_1: '/images/laye/photography1.png',
title_1: 'Docker',
img_1: '/images/heo/20231108a540b2862d26f8850172e4ea58ed075102.webp',
color_1: '#57b6e6',
title_2: 'investment2',
img_2: '/images/laye/investment2.png',
title_2: 'Photoshop',
img_2: '/images/heo/2023e4058a91608ea41751c4f102b131f267075902.webp',
color_2: '#4082c3'
},
{
title_1: 'investment3',
img_1: '/images/laye/investment3.png',
title_1: 'FinalCutPro',
img_1: '/images/heo/20233e777652412247dd57fd9b48cf997c01070702.webp',
color_1: '#ffffff',
title_2: 'yo2',
img_2: '/images/laye/yo2.png',
title_2: 'Python',
img_2: '/images/heo/20235c0731cd4c0c95fc136a8db961fdf963071502.webp',
color_2: '#ffffff'
},
{
title_1: 'photography2',
img_1: '/images/laye/photography2.png',
title_1: 'Swift',
img_1: '/images/heo/202328bbee0b314297917b327df4a704db5c072402.webp',
color_1: '#eb6840',
title_2: 'investment4',
img_2: '/images/laye/investment4.png',
title_2: 'Principle',
img_2: '/images/heo/2023f76570d2770c8e84801f7e107cd911b5073202.webp',
color_2: '#8f55ba'
},
{
title_1: 'investment5',
img_1: '/images/laye/investment5.png',
title_1: 'illustrator',
img_1: '/images/heo/20237359d71b45ab77829cee5972e36f8c30073902.webp',
color_1: '#f29e39',
title_2: 'yo3',
img_2: '/images/laye/yo3.png',
title_2: 'CSS3',
img_2: '/images/heo/20237c548846044a20dad68a13c0f0e1502f074602.webp',
color_2: '#2c51db'
},
{
title_1: 'photography3',
img_1: '/images/laye/photography3.png',
title_1: 'JS',
img_1: '/images/heo/2023786e7fc488f453d5fb2be760c96185c0075502.webp',
color_1: '#f7cb4f',
title_2: 'investment6',
img_2: '/images/laye/investment6.png',
title_2: 'HTML',
img_2: '/images/heo/202372b4d760fd8a497d442140c295655426070302.webp',
color_2: '#e9572b'
},
{
title_1: 'investment7',
img_1: '/images/laye/investment7.png',
title_1: 'Git',
img_1: '/images/heo/2023ffa5707c4e25b6beb3e6a3d286ede4c6071102.webp',
color_1: '#df5b40',
title_2: 'yo4',
img_2: '/images/laye/yo4.png',
title_2: 'Rhino',
img_2: '/images/heo/20231ca53fa0b09a3ff1df89acd7515e9516173302.webp',
color_2: '#1f1f1f'
}
],

HEO_SOCIAL_CARD: false, // 是否显示右侧,点击加入社群按钮
HEO_SOCIAL_CARD: true, // 是否显示右侧,点击加入社群按钮
HEO_SOCIAL_CARD_TITLE_1: '交流频道',
HEO_SOCIAL_CARD_TITLE_2: '加入我们的社群讨论分享',
HEO_SOCIAL_CARD_TITLE_3: '点击加入社群',
Expand Down
29 changes: 23 additions & 6 deletions themes/heo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import LazyImage from '@/components/LazyImage'
import WWAds from '@/components/WWAds'
import { AdSlot } from '@/components/GoogleAdsense'
import { siteConfig } from '@/lib/config'
import { isBrowser } from '@/lib/utils'

/**
* 基础布局 采用上中下布局,移动端使用顶部侧边导航栏
Expand Down Expand Up @@ -83,7 +84,7 @@ const LayoutBase = props => {
return (
<div
id="theme-heo"
className="bg-[#f7f9fe] dark:bg-[#18171d] h-full min-h-screen flex flex-col"
className={`${siteConfig('FONT_STYLE')} bg-[#f7f9fe] dark:bg-[#18171d] h-full min-h-screen flex flex-col scroll-smooth`}
>

<Style />
Expand Down Expand Up @@ -266,6 +267,22 @@ const LayoutSlug = props => {
siteConfig('COMMENT_GISCUS_REPO') || siteConfig('COMMENT_CUSDIS_APP_ID') || siteConfig('COMMENT_UTTERRANCES_REPO') ||
siteConfig('COMMENT_GITALK_CLIENT_ID') || siteConfig('COMMENT_WEBMENTION_ENABLE')

const router = useRouter()
useEffect(() => {
// 404
if (!post) {
setTimeout(() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
})
}
}
}, siteConfig('POST_WAITING_TIME_FOR_404') * 1000)
}
}, [post])
return (
<>
<div className={`w-full ${fullWidth ? '' : 'xl:max-w-5xl'} ${hasCode ? 'xl:w-[73.15vw]' : ''} lg:hover:shadow lg:border rounded-2xl lg:px-2 lg:py-4 bg-white dark:bg-[#18171d] dark:border-gray-600 article`}>
Expand Down Expand Up @@ -310,17 +327,17 @@ const LayoutSlug = props => {
? null
: <div className={`${commentEnable && post ? '' : 'hidden'}`}>
<hr className="my-4 border-dashed" />

{/* 评论区上方广告 */}
<div className="py-2">
<AdSlot />
</div>
{/* 评论互动 */}
<div className="duration-200 overflow-x-auto px-5">
<div className="text-2xl dark:text-white">
<i className="fas fa-comment mr-1" />
{locale.COMMON.COMMENTS}
</div>
<Comment frontMatter={post} className="" />
<div className="py-2">
<AdSlot />
</div>
</div>
</div>}
</div>
Expand Down Expand Up @@ -489,7 +506,7 @@ export {
LayoutArchive,
LayoutSlug,
Layout404,
LayoutCategoryIndex,
LayoutPostList,
LayoutCategoryIndex,
LayoutTagIndex
}

0 comments on commit 4cb317a

Please sign in to comment.