Skip to content

Commit dfc0f64

Browse files
committed
Code🤣
1 parent 22ca7f6 commit dfc0f64

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+3650
-2
lines changed

.eslintrc.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2021: true,
5+
node: true
6+
},
7+
extends: [
8+
'plugin:react/recommended',
9+
'plugin:@next/next/recommended',
10+
'standard'
11+
],
12+
parserOptions: {
13+
ecmaFeatures: {
14+
jsx: true
15+
},
16+
ecmaVersion: 12,
17+
sourceType: 'module'
18+
},
19+
plugins: ['react'],
20+
settings: {
21+
react: {
22+
version: 'detect'
23+
}
24+
},
25+
rules: {
26+
'react/prop-types': 'off'
27+
},
28+
globals: {
29+
React: true
30+
}
31+
}

.gitignore

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env.local
29+
.env.development.local
30+
.env.test.local
31+
.env.production.local
32+
33+
# vercel
34+
.vercel
35+
36+
# sitemap
37+
/public/robots.txt
38+
/public/sitemap.xml
39+
/data.json
40+
/yarn.lock
41+
.idea
42+
.vscode

.prettierrc.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"singleQuote": true,
3+
"semi": false,
4+
"trailingComma": "none",
5+
"arrowParens": "avoid"
6+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021-present, tangly1024
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Nobelium-Logo.svg

+6
Loading

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
</a>
1515
</p>
1616

17-
[中文说明 / [English](README.md)]
18-
1917
演示地址:[https://www.tangly1024.com/](https://www.tangly1024.com/)
2018

2119
<details><summary>截图</summary>

blog.config.js

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
const BLOG = {
2+
title: '塘里博客',
3+
author: 'tangly',
4+
5+
link: 'https://tangly1024.com',
6+
description: '唐风集里,收卷波澜',
7+
lang: 'zh-CN', // ['zh-CN','en-US']
8+
appearance: 'auto', // ['light', 'dark', 'auto'],
9+
font: 'font-sans', // ['font-sans', 'font-serif', 'font-mono']
10+
lightBackground: '#ffffff', // use hex value, don't forget '#' e.g #fffefc
11+
darkBackground: '#111827', // use hex value, don't forget '#'
12+
path: '', // leave this empty unless you want to deploy in a folder
13+
since: 2020, // if leave this empty, current year will be used.
14+
postsPerPage: 6,
15+
sortByDate: false,
16+
showAbout: true, // WIP
17+
showArchive: true, // WIP
18+
autoCollapsedNavBar: false, // the automatically collapsed navigation bar
19+
socialLink: 'https://weibo.com/u/2245301913',
20+
seo: {
21+
keywords: ['Blog', 'Website', 'Notion'],
22+
googleSiteVerification: '' // Remove the value or replace it with your own google site verification code
23+
},
24+
notionPageId: process.env.NOTION_PAGE_ID || 'bee1fccfa3bd47a1a7be83cc71372d83', // DO NOT CHANGE THIS!!!
25+
notionAccessToken: process.env.NOTION_ACCESS_TOKEN || '', // Useful if you prefer not to make your database public
26+
analytics: {
27+
provider: 'ga', // Currently we support Google Analytics and Ackee, please fill with 'ga' or 'ackee', leave it empty to disable it.
28+
ackeeConfig: {
29+
tracker: '', // e.g 'https://ackee.tangly1024.net/tracker.js'
30+
dataAckeeServer: '', // e.g https://ackee.tangly1024.net , don't end with a slash
31+
domainId: '' // e.g '0e2257a8-54d4-4847-91a1-0311ea48cc7b'
32+
},
33+
gaConfig: {
34+
measurementId: 'G-5EV4HZD0XX' // e.g: G-XXXXXXXXXX
35+
}
36+
},
37+
comment: {
38+
// support provider: gitalk, utterances, cusdis
39+
provider: 'cusdis', // leave it empty if you don't need any comment plugin
40+
gitalkConfig: {
41+
repo: 'NotionNext', // The repository of store comments
42+
owner: 'tangly1024',
43+
admin: ['tangly1024'],
44+
clientID: 'be7864a16b693e256f8f',
45+
clientSecret: 'dbd0f6d9ceea8940f6ed20936b415274b8fe66a2',
46+
distractionFreeMode: false
47+
},
48+
cusdisConfig: {
49+
appId: '445ba48e-f751-487f-b22f-cdbe3310d28f', // data-app-id
50+
host: 'https://cusdis.com', // data-host, change this if you're using self-hosted version
51+
scriptSrc: 'https://cusdis.com/js/cusdis.es.js' // change this if you're using self-hosted version
52+
},
53+
utterancesConfig: {
54+
repo: 'tangly1024/NotionNext'
55+
}
56+
},
57+
isProd: process.env.VERCEL_ENV === 'production' // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables)
58+
}
59+
// export default BLOG
60+
module.exports = BLOG

components/Ackee.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { useRouter } from 'next/router'
2+
import useAckee from 'use-ackee'
3+
4+
const Ackee = ({ ackeeServerUrl, ackeeDomainId }) => {
5+
const router = useRouter()
6+
useAckee(
7+
router.asPath,
8+
{ server: ackeeServerUrl, domainId: ackeeDomainId },
9+
{ detailed: false, ignoreLocalhost: true }
10+
)
11+
return null
12+
}
13+
14+
export default Ackee

components/BlogPost.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import BLOG from '@/blog.config'
2+
3+
const BlogPost = ({ post }) => {
4+
return (
5+
<article key={post.id}
6+
className='md:mx-2 w-full md:max-w-md duration-200 transform hover:scale-105 hover:shadow-2xl bg-white dark:bg-gray-800 dark:hover:bg-gray-600 overflow-hidden'>
7+
{/* 封面图 */}
8+
{post.page_cover && post.page_cover.length > 1 && (
9+
<a href={`${BLOG.path}/article/${post.slug}`} className='md:flex-shrink-0 md:w-52 md:h-52 rounded-lg'>
10+
<img className='w-full max-h-60 object-cover p-3 cursor-pointer' src={post.page_cover} alt={post.title} />
11+
</a>
12+
)}
13+
14+
<main className='px-8 py-2'>
15+
<a href={`${BLOG.path}/article/${post.slug}`}
16+
className='block my-3 text-2xl leading-tight font-semibold text-black dark:text-gray-200 hover:underline'>
17+
{post.title}
18+
</a>
19+
<p className='mt-2 text-gray-500 dark:text-gray-400 text-sm'>{post.summary}</p>
20+
</main>
21+
</article>
22+
)
23+
}
24+
25+
export default BlogPost

components/BlogPostMini.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import BLOG from '@/blog.config'
2+
3+
const BlogPostMini = ({ post }) => {
4+
return (
5+
<a key={post.id} href={`${BLOG.path}/article/${post.slug}`}
6+
className='md:flex w-full border my-2 duration-200 transform hover:scale-105 hover:shadow-2xl bg-white dark:bg-gray-800 dark:hover:bg-gray-600'>
7+
{/* 封面图 */}
8+
{post.page_cover && post.page_cover.length > 1 && (
9+
<img className='md:w-40 w-full max-h-32 object-cover cursor-pointer' src={post.page_cover} alt={post.title} />
10+
)}
11+
12+
<main className='px-2 py-1'>
13+
<a href={`${BLOG.path}/article/${post.slug}`}
14+
className='block my-3 leading-tight font-semibold text-black dark:text-gray-200 hover:underline'>
15+
{post.title}
16+
</a>
17+
<p className='mt-2 text-gray-500 dark:text-gray-400 text-xs overflow-x-hidden'>{post.summary}</p>
18+
<p className='mt-2 text-gray-500 dark:text-gray-400 text-xs overflow-x-hidden'>{BLOG.link}/article/{post.slug}</p>
19+
</main>
20+
</a>
21+
)
22+
}
23+
24+
export default BlogPostMini

components/Comment.js

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import BLOG from '@/blog.config'
2+
import dynamic from 'next/dynamic'
3+
import { useRouter } from 'next/router'
4+
5+
const GitalkComponent = dynamic(
6+
() => {
7+
return import('gitalk/dist/gitalk-component')
8+
},
9+
{ ssr: false }
10+
)
11+
const UtterancesComponent = dynamic(
12+
() => {
13+
return import('@/components/Utterances')
14+
},
15+
{ ssr: false }
16+
)
17+
const CusdisComponent = dynamic(
18+
() => {
19+
return import('react-cusdis').then(m => m.ReactCusdis)
20+
},
21+
{ ssr: false }
22+
)
23+
24+
const Comment = ({ frontMatter }) => {
25+
const router = useRouter()
26+
27+
return <div className='comment'>
28+
<div className='font-bold text-gray-800 pt-2 pb-4 dark:text-gray-300'>留下评论</div>
29+
30+
{/* 评论插件 */}
31+
{BLOG.comment.provider === 'gitalk' && (
32+
<GitalkComponent
33+
options={{
34+
id: frontMatter.id,
35+
title: frontMatter.title,
36+
clientID: BLOG.comment.gitalkConfig.clientID,
37+
clientSecret: BLOG.comment.gitalkConfig.clientSecret,
38+
repo: BLOG.comment.gitalkConfig.repo,
39+
owner: BLOG.comment.gitalkConfig.owner,
40+
admin: BLOG.comment.gitalkConfig.admin,
41+
distractionFreeMode: BLOG.comment.gitalkConfig.distractionFreeMode
42+
}}
43+
/>
44+
)}
45+
{BLOG.comment.provider === 'utterances' && (
46+
<UtterancesComponent issueTerm={frontMatter.id} className='px-2' />
47+
)}
48+
{BLOG.comment.provider === 'cusdis' && (
49+
<>
50+
<script defer src='https://cusdis.com/js/widget/lang/zh-cn.js' />
51+
<CusdisComponent
52+
attrs={{
53+
host: BLOG.comment.cusdisConfig.host,
54+
appId: BLOG.comment.cusdisConfig.appId,
55+
pageId: frontMatter.id,
56+
pageTitle: frontMatter.title,
57+
pageUrl: BLOG.link + router.asPath,
58+
theme: BLOG.appearance
59+
}}
60+
lang={BLOG.lang.toLowerCase()}
61+
/>
62+
</>
63+
64+
)}</div>
65+
}
66+
67+
export default Comment

components/CommonHead.js

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import BLOG from '@/blog.config'
2+
import Head from 'next/head'
3+
4+
const CommonHead = ({ meta }) => {
5+
const url = BLOG.path.length ? `${BLOG.link}/${BLOG.path}` : BLOG.link
6+
7+
return <Head>
8+
<title>{meta.title}</title>
9+
<meta content={BLOG.darkBackground} name='theme-color' />
10+
<meta name='robots' content='follow, index' />
11+
<meta charSet='UTF-8' />
12+
{BLOG.seo.googleSiteVerification && (
13+
<meta
14+
name='google-site-verification'
15+
content={BLOG.seo.googleSiteVerification}
16+
/>
17+
)}
18+
{BLOG.seo.keywords && (
19+
<meta name='keywords' content={BLOG.seo.keywords.join(', ')} />
20+
)}
21+
<meta name='description' content={meta.description} />
22+
<meta property='og:locale' content={BLOG.lang} />
23+
<meta property='og:title' content={meta.title} />
24+
<meta property='og:description' content={meta.description} />
25+
<meta
26+
property='og:url'
27+
content={meta.slug ? `${url}/${meta.slug}` : url}
28+
/>
29+
<meta property='og:type' content={meta.type} />
30+
<meta name='twitter:card' content='summary_large_image' />
31+
<meta name='twitter:description' content={meta.description} />
32+
<meta name='twitter:title' content={meta.title} />
33+
{meta.type === 'article' && (
34+
<>
35+
<meta
36+
property='article:published_time'
37+
content={meta.date || meta.createdTime}
38+
/>
39+
<meta property='article:author' content={BLOG.author} />
40+
</>
41+
)}
42+
</Head>
43+
}
44+
45+
export default CommonHead

components/ContactButton.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react'
2+
import Link from 'next/link'
3+
4+
/**
5+
* 悬浮在屏幕右下角,联系我的按钮
6+
* @returns {JSX.Element}
7+
* @constructor
8+
*/
9+
const ContactButton = () => {
10+
return (
11+
<Link href='/article/about'>
12+
<a className={'fixed right-10 bottom-40 animate__fadeInRight animate__animated animate__faster'}>
13+
<span
14+
className='dark:bg-black bg-white px-5 py-3 cursor-pointer shadow-card text-xl hover:bg-blue-500 transform duration-200 hover:text-white hover:shadow'>
15+
<span className='dark:text-gray-200 fa fa-info' title='about' />
16+
</span>
17+
</a>
18+
</Link>
19+
)
20+
}
21+
22+
export default ContactButton

0 commit comments

Comments
 (0)