diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..5fffb37a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,52 @@ +# Contributing + +- [Setup](#setup) +- [Creating new themes](#creating-new-themes) +- [Adding localizations](#adding-localizations) + +Thanks for considering to contribute! + +## Setup + +To contribute to NotionNext, follow these steps: + +1. [Fork][fork] the repository to your GitHub account. +2. Clone the repository to your device (or use something like Codespaces). +3. Create a new branch in the repository. +4. Make your modifications. +5. Commit your modifications and push the branch. +6. [Create a PR][pr] from the branch in your fork to NotionNext' `main` branch. + +This project is built with [Next.js][next.js] and `yarn` as the package manager. +Here are some commands that you can use: + +- `yarn`: install dependencies +- `yarn dev`: compile and hot-reload for development +- `yarn build`: compile and minify for production +- `yarn start`: serve the compiled build in production mode + +## Creating new themes + +If you want to submit your custom theme to NotionNext, copy a new folder in +[`themes`][themes-dir] from [`example`][example]. The folder name will be the +theme's key. + +## Adding localizations + +If your language is not yet supported by NotionNext, please contribute a +localization! Follow these steps to add a new localization: + +1. Copy one of the [en-US.js][en-US.js] in [lang-dir][lang-dir] and rename the new + directory into your language's code ( e.g. `zh-CN.js`). +2. Start translating the strings. +3. Add your language config to [lang.js][lang.js]. +4. [Create a PR][pr] with your localization updates. + +[fork]: https://github.com/tangly1024/NotionNext/fork +[pr]: https://github.com/tangly1024/NotionNext/compare +[next.js]: https://github.com/vercel/next.js +[themes-dir]: themes +[example]: themes/example +[lang-dir]: lib/lang +[en-US.js]: lib/lang/en-US.js +[lang.js]: lib/lang.js diff --git a/README.md b/README.md index dbec7c25..92b2c1b6 100644 --- a/README.md +++ b/README.md @@ -50,12 +50,9 @@ |--|--|--|--| | [预览NEXT](https://preview.tangly1024.com/?theme=next) | [预览MEDIUM](https://preview.tangly1024.com/?theme=medium) | [预览HEXO](https://preview.tangly1024.com/?theme=hexo) | [预览FUKASAWA](https://preview.tangly1024.com/?theme=fukasawa) | +*只需修改`blog.config.js`文件的`THEME`即可实现主题切换。* 没找到喜欢的主题?[贡献](/CONTRIBUTING.md)一个吧~ -*只需修改`blog.config.js`文件的`THEME`即可实现主题切换。* - -## 更新日志 -请移步 [更新文档](https://docs.tangly1024.com/zh/changelog)查看 ## 快速起步 @@ -80,11 +77,15 @@ yarn run start # 本地启动NextJS服务 ## 引用技术 -- **框架**: Next.js +- **框架**: [Next.js](https://nextjs.org) - **样式**: [Tailwind CSS](https://www.tailwindcss.cn/) 和 `@tailwindcss/jit` compiler - **渲染**: [React-notion-x](https://github.com/NotionX/react-notion-x) -- **评论**: Gitalk, Cusdis, Utterances -- **图标**:[fontawesome](https://fontawesome.com/v5.15/icons?d=gallery) +- **评论**: [Giscus](https://giscus.app/zh-CN), [Gitalk](https://gitalk.github.io), [Cusdis](https://gitalk.github.io), [Utterances](https://utteranc.es) +- **图标**:[fontawesome v5.15](https://fontawesome.com/v5.15/icons?d=gallery) + +## 更新日志 +请移步 [更新文档](https://docs.tangly1024.com/zh/changelog)查看 + ## 致谢 感谢Craig Hart发起的Nobelium项目 @@ -92,13 +93,16 @@ yarn run start # 本地启动NextJS服务 Craig Hart
Craig Hart -## Contributors +## 贡献者
tangly1024
tangly1024

🎫 🔧 🎨 🐛
uWayLu
uWayLu

🔧 🐛
+十分期待你的[贡献](/CONTRIBUTING.md),一起来完善这个项目~ + + ## License The MIT License. diff --git a/components/DebugPanel.js b/components/DebugPanel.js index b1623e50..50add94a 100644 --- a/components/DebugPanel.js +++ b/components/DebugPanel.js @@ -2,7 +2,7 @@ import BLOG from '@/blog.config' import * as ThemeMap from '@/themes' import { useState } from 'react' import Select from './Select' -import { ALL_THEME } from '@/lib/theme' +import { ALL_THEME } from '@/themes' import { useGlobal } from '@/lib/global' /** * diff --git a/lib/global.js b/lib/global.js index 8ca8deed..e1692217 100644 --- a/lib/global.js +++ b/lib/global.js @@ -2,7 +2,8 @@ import { generateLocaleDict, initLocale } from './lang' import { createContext, useContext, useEffect, useState } from 'react' import Router from 'next/router' import BLOG from '@/blog.config' -import { ALL_THEME, initDarkMode, initTheme, saveThemeToCookies } from '@/lib/theme' +import { initDarkMode, initTheme, saveThemeToCookies } from '@/lib/theme' +import { ALL_THEME } from '@/themes' const GlobalContext = createContext() let hasInit = false diff --git a/lib/theme.js b/lib/theme.js index 55d47aad..1cecad78 100644 --- a/lib/theme.js +++ b/lib/theme.js @@ -1,7 +1,6 @@ import cookie from 'react-cookies' import BLOG from '@/blog.config' -export const ALL_THEME = ['hexo', 'next', 'medium', 'fukasawa', 'empty'] /** * 初始化主题 * @param isDarkMode diff --git a/themes/empty/Layout404.js b/themes/example/Layout404.js similarity index 100% rename from themes/empty/Layout404.js rename to themes/example/Layout404.js diff --git a/themes/empty/LayoutArchive.js b/themes/example/LayoutArchive.js similarity index 100% rename from themes/empty/LayoutArchive.js rename to themes/example/LayoutArchive.js diff --git a/themes/empty/LayoutBase.js b/themes/example/LayoutBase.js similarity index 100% rename from themes/empty/LayoutBase.js rename to themes/example/LayoutBase.js diff --git a/themes/empty/LayoutCategory.js b/themes/example/LayoutCategory.js similarity index 100% rename from themes/empty/LayoutCategory.js rename to themes/example/LayoutCategory.js diff --git a/themes/empty/LayoutCategoryIndex.js b/themes/example/LayoutCategoryIndex.js similarity index 100% rename from themes/empty/LayoutCategoryIndex.js rename to themes/example/LayoutCategoryIndex.js diff --git a/themes/empty/LayoutIndex.js b/themes/example/LayoutIndex.js similarity index 100% rename from themes/empty/LayoutIndex.js rename to themes/example/LayoutIndex.js diff --git a/themes/empty/LayoutPage.js b/themes/example/LayoutPage.js similarity index 100% rename from themes/empty/LayoutPage.js rename to themes/example/LayoutPage.js diff --git a/themes/empty/LayoutSearch.js b/themes/example/LayoutSearch.js similarity index 100% rename from themes/empty/LayoutSearch.js rename to themes/example/LayoutSearch.js diff --git a/themes/empty/LayoutSlug.js b/themes/example/LayoutSlug.js similarity index 100% rename from themes/empty/LayoutSlug.js rename to themes/example/LayoutSlug.js diff --git a/themes/empty/LayoutTag.js b/themes/example/LayoutTag.js similarity index 100% rename from themes/empty/LayoutTag.js rename to themes/example/LayoutTag.js diff --git a/themes/empty/LayoutTagIndex.js b/themes/example/LayoutTagIndex.js similarity index 100% rename from themes/empty/LayoutTagIndex.js rename to themes/example/LayoutTagIndex.js diff --git a/themes/empty/components/ArticleLock.js b/themes/example/components/ArticleLock.js similarity index 100% rename from themes/empty/components/ArticleLock.js rename to themes/example/components/ArticleLock.js diff --git a/themes/empty/components/SearchInput.js b/themes/example/components/SearchInput.js similarity index 100% rename from themes/empty/components/SearchInput.js rename to themes/example/components/SearchInput.js diff --git a/themes/empty/config_empty.js b/themes/example/config_empty.js similarity index 100% rename from themes/empty/config_empty.js rename to themes/example/config_empty.js diff --git a/themes/empty/index.js b/themes/example/index.js similarity index 100% rename from themes/empty/index.js rename to themes/example/index.js diff --git a/themes/index.js b/themes/index.js index 286446ca..e13cd4b3 100644 --- a/themes/index.js +++ b/themes/index.js @@ -5,11 +5,7 @@ import * as next from './next' import * as fukasawa from './fukasawa' import * as hexo from './hexo' import * as medium from './medium' -import * as empty from './empty' -export { - next, - fukasawa, - hexo, - medium, - empty -} +import * as example from './example' + +export const ALL_THEME = ['hexo', 'next', 'medium', 'fukasawa', 'example'] +export { hexo, next, medium, fukasawa, example }