-
{page.content}
+
+ {page.comments ? (
+
+ ) : (
+ ""
+ )}
);
}
diff --git a/move_config.js b/move_config.js
deleted file mode 100644
index ac9951d8c..000000000
--- a/move_config.js
+++ /dev/null
@@ -1,19 +0,0 @@
-const fs = require('fs')
-
-if (fs.existsSync('../hexo/package.json')){
- const version = JSON.parse(fs.readFileSync('../hexo/package.json')).version
- if (version.split('.')[0] === '5') {
- const oldConfigPath = '../../_config.old.yml'
- const configPath = '../../_config.nexmoe.yml'
- if (fs.existsSync(configPath)) {
- fs.writeFileSync( '../../_config.new.yml', fs.readFileSync('./source/_config.yml'))
- } else if(!fs.existsSync(oldConfigPath)) {
- fs.writeFileSync(configPath, fs.readFileSync('./source/_config.yml'))
- logger.info('Successful installation!')
- logger.info('Please modify the file `_config.nexmoe.yml` in the root directory')
- }
- fs.unlinkSync('./source/_config.yml')
- }
-}
-
-// 借鉴自 https://github.com/HCLonely/hexo-theme-webstack/blob/master/move_config.js
\ No newline at end of file
diff --git a/package.json b/package.json
index 3bbac12c5..3293c674a 100644
--- a/package.json
+++ b/package.json
@@ -11,9 +11,7 @@
"license": "Apache-2.0",
"main": "index.js",
"scripts": {
- "eslint": "eslint scripts/ source/js --fix",
- "test": "echo test",
- "postinstall": "node ./move_config.js"
+ "lint": "eslint --ext .js --ext .jsx --ext .json ."
},
"repository": {
"type": "git",
diff --git a/scripts/index.js b/scripts/index.js
index 453ea9369..ecf70a7b6 100644
--- a/scripts/index.js
+++ b/scripts/index.js
@@ -1,19 +1,28 @@
-const path = require('path');
-const fs = require('fs');
-// 文件拷贝
-function copyFile(src, dst) {
- fs.writeFileSync(dst, fs.readFileSync(src));
-}
-// 检测是否有主题配置文件
-console.info(' [Nexmoe] Checking theme configurations');
-let themeF = hexo.theme_dir.split(path.sep);
-themeF = themeF[themeF.length-2];
-let sitePC = themeF !== 'hexo-theme-nexmoe' ? path.join(hexo.base_dir, `_config.${themeF}.yml`) : path.join(hexo.base_dir, `_config.nexmoe.yml`);
-if(!fs.existsSync(sitePC)) {
- console.warn(' [Nexmoe] Theme configuration not found');
- console.info(' [Nexmoe] Generating theme configuration file...');
- const themePC = path.join(hexo.theme_dir, 'source', '_config.yml');
- copyFile(themePC, sitePC);
-} else {
- console.info(' [Nexmoe] Theme configuration found');
-}
\ No newline at end of file
+/* global hexo */
+const logger = require('hexo-log')();
+
+/**
+ * Print welcome message
+ */
+logger.info(`===============================================
+███ ██ ███████ ██ ██ ███ ███ ██████ ███████
+████ ██ ██ ██ ██ ████ ████ ██ ██ ██
+██ ██ ██ █████ ███ ██ ████ ██ ██ ██ █████
+██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
+██ ████ ███████ ██ ██ ██ ██ ██████ ███████
+=====================================================`);
+
+/**
+ * Check if all dependencies are installed
+ */
+require('../include/dependency')(hexo);
+
+/**
+ * Configuration file checking and migration
+ */
+require('../include/config')(hexo);
+
+/**
+ * Register Hexo extensions and remove Hexo filters that could cause OOM
+ */
+require('../include/register')(hexo);
From a7ca8aa73cf3795ecc3995a584095c64aebc8cca Mon Sep 17 00:00:00 2001
From: Nexmoe <16796652+nexmoe@users.noreply.github.com>
Date: Sat, 18 Mar 2023 22:55:19 +0800
Subject: [PATCH 3/8] chore: jsx
---
layout/_partial/background.jsx | 38 ++++++++++++
layout/_partial/head.ejs | 106 ++++++++++++++++-----------------
layout/_partial/right.ejs | 22 +++++++
layout/layout.ejs | 54 -----------------
layout/layout.jsx | 49 +++++++++++++++
5 files changed, 161 insertions(+), 108 deletions(-)
create mode 100644 layout/_partial/background.jsx
create mode 100644 layout/_partial/right.ejs
delete mode 100644 layout/layout.ejs
create mode 100644 layout/layout.jsx
diff --git a/layout/_partial/background.jsx b/layout/_partial/background.jsx
new file mode 100644
index 000000000..a78fa4f4b
--- /dev/null
+++ b/layout/_partial/background.jsx
@@ -0,0 +1,38 @@
+const { Component } = require("inferno");
+
+module.exports = class extends Component {
+ render() {
+ const { config, theme, url_for } = this.props;
+
+ return (
+
- <%- partial('_layout/single/content') %>
-
-
- <%- partial('_partial/searchbox') %>
-
- <%- theme.slotFooter %>
-
-
-
diff --git a/layout/layout.jsx b/layout/layout.jsx
new file mode 100644
index 000000000..804a484b0
--- /dev/null
+++ b/layout/layout.jsx
@@ -0,0 +1,49 @@
+const { Component } = require("inferno");
+const Background = require("./_partial/background");
+
+module.exports = class extends Component {
+ render() {
+ const { config, page, theme, partial, url_for } = this.props;
+
+ const language = page.lang || page.language || config.language;
+
+ return (
+
+
+
+
© <%= date(new Date(), 'YYYY') %> <%= config.author || config.title %>
<%= __('Powered by') %>
Hexo
diff --git a/layout/_layout/single/content.ejs b/layout/_layout/single/content.ejs
deleted file mode 100644
index 075dd0ce7..000000000
--- a/layout/_layout/single/content.ejs
+++ /dev/null
@@ -1,3 +0,0 @@
-
- <%- body %>
-
\ No newline at end of file
diff --git a/layout/_layout/xiaoshu/content.jsx b/layout/_layout/xiaoshu/content.jsx
new file mode 100644
index 000000000..6738ce0f1
--- /dev/null
+++ b/layout/_layout/xiaoshu/content.jsx
@@ -0,0 +1,14 @@
+const { Component } = require("inferno");
+
+module.exports = class extends Component {
+ render() {
+ const { body } = this.props;
+
+ return (
+
+ );
+ }
+};
diff --git a/layout/_layout/xiaoshu/footer.jsx b/layout/_layout/xiaoshu/footer.jsx
new file mode 100644
index 000000000..b091034ff
--- /dev/null
+++ b/layout/_layout/xiaoshu/footer.jsx
@@ -0,0 +1,28 @@
+const { Component } = require("inferno");
+
+module.exports = class extends Component {
+ render() {
+ const { config, date, theme, __ } = this.props;
+
+ return (
+ <>
+
+ © {date(new Date(), "YYYY")}{" "}
+ {config.author || config.title}
+ {__("Powered by")}
+
+ Hexo
+
+ &{" "}
+
+ Nexmoe
+
+ {theme.slotSidebar}
+
+ >
+ );
+ }
+};
diff --git a/layout/_layout/xiaoshu/header.jsx b/layout/_layout/xiaoshu/header.jsx
new file mode 100644
index 000000000..e69de29bb
diff --git a/layout/_partial/right.ejs b/layout/_partial/right.ejs
index dee613c8f..dfc4c87ac 100644
--- a/layout/_partial/right.ejs
+++ b/layout/_partial/right.ejs
@@ -1,4 +1,3 @@
-
\ No newline at end of file
diff --git a/layout/layout.jsx b/layout/layout.jsx
index ad9eec013..e6e9128cb 100644
--- a/layout/layout.jsx
+++ b/layout/layout.jsx
@@ -4,8 +4,11 @@ const Background = require("./_partial/background");
module.exports = class extends Component {
render() {
const { config, page, theme, partial } = this.props;
-
const language = page.lang || page.language || config.language;
+ const layout = "nexmoe";
+ const bodyClass = layout === "nexmoe" ? "mdui-drawer-body-left" : "";
+ const Content = require(`./_layout/${layout}/content`);
+ const Footer = require(`./_layout/${layout}/footer`);
return (
@@ -14,22 +17,23 @@ module.exports = class extends Component {
__html: partial("_partial/head"),
}}
>
-
+
-
+
+
+
* {
+ margin-right: 8px;
+ float: left;
+ color: #999;
+ border-radius: 50%;
+ width: 36px;
+ height: 36px;
+ line-height: 36px;
+ background-color: #f5f6f5;
+}
\ No newline at end of file
diff --git a/source/css/_widget/index.styl b/source/css/_widget/index.styl
new file mode 100644
index 000000000..db05da2a1
--- /dev/null
+++ b/source/css/_widget/index.styl
@@ -0,0 +1,115 @@
+.nexmoe-widget-wrap {
+ box-shadow: 0 0 1rem var(--color-shadow);
+ background-color: #fff;
+ margin: 20px;
+ border-radius: var(--radius);
+ overflow: hidden;
+ white-space: normal;
+
+ .nexmoe-widget-title {
+ font-size: 1em;
+ font-weight: 400;
+ padding: 24px 18px 12px;
+ margin: 0;
+ color: var(--color-primary);
+ }
+
+ .nexmoe-widget {
+ ul {
+ list-style-type: none;
+ padding: 0;
+ margin: 0;
+
+ li {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ position: relative;
+ padding: 12px 18px;
+
+ a {
+ color: #606266;
+ }
+ }
+
+ li:last-child {
+ border-bottom: none;
+ padding-bottom: 24px;
+ }
+ }
+
+ .category-list-count, .archive-list-count {
+ background-color: var(--color-primary-bg);
+ display: inline-block;
+ width: 26px;
+ height: 26px;
+ line-height: 26px;
+ text-align: center;
+ border-radius: 100%;
+ color: var(--color-primary);
+ position: absolute;
+ right: 18px;
+ top: 10px;
+ }
+ }
+
+ .tagcloud {
+ padding: 10px;
+ padding-bottom: 6px;
+ padding-top: 11px;
+
+ a {
+ border-radius: var(--radius);
+ padding: 5px 10px;
+ font-size: 12px !important;
+ display: inline-block;
+ margin-bottom: 5px;
+ }
+
+ a:before {
+ content: '# ';
+ }
+ }
+
+ .nexmoe-search {
+ input {
+ border: none !important;
+ background-color: transparent;
+ padding: 20px;
+ box-sizing: border-box;
+ outline: none;
+ }
+ }
+
+ input::-webkit-search-decoration, input::-webkit-search-cancel-button {
+ display: none !important;
+ }
+
+ .nexmoe-social {
+ padding: 12px;
+ font-size: 0;
+
+ a {
+ width: 41px;
+ height: 41px;
+ line-height: 41px;
+ margin: 4px;
+ border-radius: 100%;
+ display: inline-block;
+ text-align: center;
+ color: #606266;
+ }
+ }
+}
+
+.nexmoe-widget-wrap:first-child {
+ margin-top: 0;
+}
+@media screen and (max-width: 1024px) {
+ #nexmoe-header .nexmoe-social a {
+ margin: 5px;
+ width: 44px;
+ height: 44px;
+ line-height: 44px;
+ }
+}
\ No newline at end of file
diff --git a/source/css/style.styl b/source/css/style.styl
index 2fad9e637..5821fb3d4 100644
--- a/source/css/style.styl
+++ b/source/css/style.styl
@@ -20,12 +20,10 @@ $gutter = 24px;
--color-shadow: rgba(161, 177, 204, 0.4);
}
-@import '_partial/archives.styl';
-@import '_partial/article.styl';
-@import '_partial/py.styl';
-@import '_partial/searchbox.styl';
-@import '_widget/hitokoto.styl';
-@import '_partial/copy-codeblock.styl';
+@import '_partial/*';
+@import '_index/*';
+@import '_widget/*';
+@import '_layout/*/*';
*, *:after, *::before {
box-sizing: border-box;
@@ -50,542 +48,6 @@ body.mdui-drawer-body-left {
box-shadow: 0 1em 3em 0.5em rgba(0, 0, 0, 0.25);
}
-#nexmoe-background {
- .nexmoe-bg {
- opacity: 0.2;
- background-size: cover;
- filter: blur(30px);
- height: 100vh;
- width: 100%;
- position: fixed;
- top: 0;
- left: 0;
- z-index: -1;
- }
-
- .mdui-appbar {
- padding: 10px;
- display: none;
-
- img {
- width: 100%;
- }
- }
-}
-
-@media screen and (max-width: 1023px) {
- #nexmoe-background {
- .mdui-appbar {
- display: block !important;
- }
- }
-}
-
-#nexmoe-header {
- margin-left: -260px;
-
- .mdui-drawer {
- left: unset;
- scrollbar-width: none;
- }
-
- .mdui-drawer::-webkit-scrollbar {
- display: none;
- }
-
- .nexmoe-avatar, .nexmoe-avatar img {
- width: 100%;
- font-size: 0 0;
- border-radius: 80px;
- -webkit-border-radius: 80px;
- -moz-border-radius: 80px;
- box-shadow: inset 0 -1px 0 #333 sf;
- -webkit-transition: -webkit-transform 1.5s ease-out;
- -moz-transition: -moz-transform 1.5s ease-out;
- transition: transform 1.5s ease-out;
- }
-
- .nexmoe-avatar {
- margin: 45px;
- z-index: 4;
- position: relative;
- font-size: 0;
- width: calc(100% - 90px);
- overflow: hidden;
- border-radius: 100%;
- box-shadow: 0 0.3rem 2rem var(--color-shadow);
-
- a {
- padding-bottom: 100%;
- display: block;
- height: 0;
- }
- }
-
- .nexmoe-count {
- padding: 0 30px;
- margin-bottom: 30px;
- display: -webkit-box;
- display: -ms-flexbox;
- display: flex;
-
- div {
- -webkit-box-flex: 1;
- -ms-flex: 1;
- flex: 1;
- text-align: center;
- color: #a3a8ae;
-
- span {
- color: #363636;
- display: block;
- }
- }
- }
-
- .nexmoe-search {
- input {
- border: none !important;
- background-color: transparent;
- padding: 20px;
- box-sizing: border-box;
- outline: none;
- }
- }
-
- input::-webkit-search-decoration, input::-webkit-search-cancel-button {
- display: none !important;
- }
-
- .nexmoe-social {
- padding: 12px;
- font-size: 0;
-
- a {
- width: 41px;
- height: 41px;
- line-height: 41px;
- margin: 4px;
- border-radius: 100%;
- display: inline-block;
- text-align: center;
- color: #606266;
- }
- }
-
- .nexmoe-list {
- padding: 8px 20px;
-
- .nexmoe-list-item {
- padding: 0 36px;
- color: #9ca2a8;
- border-radius: var(--radius);
- margin-bottom: 10px;
- text-align: center;
- transition: none !important;
- }
-
- .nexmoe-list-item.true, .nexmoe-list-item.true i {
- color: #fff;
- }
-
- .nexmoe-list-item.true {
- opacity: 0.9;
- background: var(--color-primary);
- box-shadow: 0 2px 12px var(--color-primary);
- }
-
- .nexmoe-list-item i {
- font-size: 22px;
- color: #9ca2a8;
- }
-
- .nexmoe-list-item .mdui-list-item-content {
- margin-left: 0px;
- }
- }
-
- .nexmoe-widget-wrap {
- box-shadow: 0 0 1rem var(--color-shadow);
- background-color: #fff;
- margin: 20px;
- border-radius: var(--radius);
- overflow: hidden;
- white-space: normal;
-
- .nexmoe-widget-title {
- font-size: 1em;
- font-weight: 400;
- padding: 24px 18px 12px;
- margin: 0;
- color: var(--color-primary);
- }
-
- .nexmoe-widget {
- ul {
- list-style-type: none;
- padding: 0;
- margin: 0;
-
- li {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- position: relative;
- padding: 12px 18px;
-
- a {
- color: #606266;
- }
- }
-
- li:last-child {
- border-bottom: none;
- padding-bottom: 24px;
- }
- }
-
- .category-list-count, .archive-list-count {
- background-color: var(--color-primary-bg);
- display: inline-block;
- width: 26px;
- height: 26px;
- line-height: 26px;
- text-align: center;
- border-radius: 100%;
- color: var(--color-primary);
- position: absolute;
- right: 18px;
- top: 10px;
- }
- }
-
- .tagcloud {
- padding: 10px;
- padding-bottom: 6px;
- padding-top: 11px;
-
- a {
- border-radius: var(--radius);
- padding: 5px 10px;
- font-size: 12px !important;
- display: inline-block;
- margin-bottom: 5px;
- }
-
- a:before {
- content: '# ';
- }
- }
- }
-
- .nexmoe-widget-wrap:first-child {
- margin-top: 0;
- }
-
- .nexmoe-copyright {
- padding: 0 30px;
- text-align: center;
- color: #777;
- white-space: normal;
- margin-bottom: 20px;
- font-size: 12px;
-
- a {
- color: var(--color-primary);
- }
- }
-}
-
-@media screen and (max-width: 1024px) {
- #nexmoe-header {
- margin-left: 0;
-
- .mdui-drawer {
- left: 0;
- }
- }
-}
-
-#nexmoe-content {
- position: relative;
-
- .nexmoe-primary {
- box-shadow: 0 0 1rem var(--color-shadow);
- background-color: #fff;
- float: left;
- width: 100%;
- padding: $gutter;
- position: absolute;
- min-height: 100vh;
-
- .nexmoe-page-nav {
- list-style: none;
- color: #ddd;
- text-align: center;
- margin-top: 48px;
- display: flex;
-
- .prev {
- margin-left: 8px;
- }
-
- .current {
- color: #fff;
- background: var(--color-primary);
- opacity: 0.9;
- box-shadow: 0 2px 12px var(--color-primary);
- }
- }
-
- .nexmoe-page-nav > * {
- margin-right: 8px;
- float: left;
- color: #999;
- border-radius: 50%;
- width: 36px;
- height: 36px;
- line-height: 36px;
- background-color: #f5f6f5;
- }
- }
-
- .nexmoe-posts {
- position: relative;
-
- .nexmoe-post {
- width: 100%;
- margin-bottom: 40px;
-
- article p:first-child {
- margin-top: 0;
- }
-
- article p:last-child {
- margin-bottom: 0;
- }
- }
-
- .nexmoe-post:last-child {
- margin-bottom: $gutter;
- }
- }
-
- .nexmoe-post {
- .nexmoe-post-cover {
- width: 100%;
- position: relative;
- overflow: hidden;
- border-radius: 16px;
- min-height: 95px;
- background-color: #eee;
- padding-top: 20%;
-
- img {
- display: block;
- position: absolute;
- left: 0;
- top: 0;
- object-fit: cover;
- width: 100%;
- height: 100%;
- }
-
- h1 {
- position: relative;
- color: #fff;
- font-size: 2.5rem;
- margin-top: 10px;
- width: 100%;
- box-sizing: border-box;
- text-transform: none;
- margin: 0;
- padding: $gutter;
- z-index: 1;
- text-shadow: 0 1px 3px #00000040;
- }
-
- h1:after {
- background-image: -moz-linear-gradient(to top, rgba(16, 16, 16, 0.35) 25%, rgba(16, 16, 16, 0) 100%);
- background-image: -webkit-linear-gradient(to top, rgba(16, 16, 16, 0.35) 25%, rgba(16, 16, 16, 0) 100%);
- background-image: -ms-linear-gradient(to top, rgba(16, 16, 16, 0.35) 25%, rgba(16, 16, 16, 0) 100%);
- background-image: linear-gradient(to top, rgba(16, 16, 16, 0.35) 25%, rgba(16, 16, 16, 0) 100%);
- -moz-pointer-events: none;
- -webkit-pointer-events: none;
- -ms-pointer-events: none;
- pointer-events: none;
- background-size: cover;
- content: '';
- display: block;
- height: 100%;
- left: 0;
- position: absolute;
- bottom: 0;
- width: 100%;
- z-index: -1;
- }
- }
-
- .nexmoe-post-cover.absolute {
- h1 {
- position: absolute;
- bottom: 0;
- z-index: 1;
- }
- }
-
- .nexmoe-post-meta {
- margin: 10px 0px;
- font-size: 0;
-
- div {
- display: inline-block;
- }
-
- a {
- border-radius: 20px;
- padding: 10px 18px;
- font-size: 14px;
- display: inline-block;
- margin-bottom: 5px;
- margin-right: 10px;
- text-decoration: none;
-
- .nexmoefont {
- font-size: 14px;
- }
- }
-
- a:before {
- margin-right: 5px;
- }
-
- .wechat {
- background-color: rgba(42, 174, 103, 20%);
- color: #2aae67;
- }
-
- .zhihu {
- background-color: rgba(5, 109, 232, 20%);
- color: #056de8;
- }
-
- .bilibili {
- background-color: rgba(251, 114, 153, 20%);
- color: #fb7299;
- }
-
- .sspai {
- background-color: rgba(218, 40, 42, 20%);
- color: #da282a;
- }
- }
-
- .nexmoe-post-copyright {
- margin: 0 -25px;
- margin-bottom: 25px;
- padding: 25px;
- color: #191919;
- background-color: #fafafa;
- line-height: 1.5em;
- position: relative;
- overflow: hidden;
-
- a {
- color: var(--color-primary);
- }
- }
-
- .nexmoe-post-copyright:after {
- position: absolute;
- background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 496 512'%3E%3Cpath fill='%234a4a4a' d='M245.8 214.9l-33.2 17.3c-9.4-19.6-25.2-20-27.4-20-22.2 0-33.3 14.6-33.3 43.9 0 23.5 9.2 43.8 33.3 43.8 14.4 0 24.6-7 30.5-21.3l30.6 15.5a73.2 73.2 0 01-65.1 39c-22.6 0-74-10.3-74-77 0-58.7 43-77 72.6-77 30.8-.1 52.7 11.9 66 35.8zm143 0l-32.7 17.3c-9.5-19.8-25.7-20-27.9-20-22.1 0-33.2 14.6-33.2 43.9 0 23.5 9.2 43.8 33.2 43.8 14.5 0 24.7-7 30.5-21.3l31 15.5c-2 3.8-21.3 39-65 39-22.7 0-74-9.9-74-77 0-58.7 43-77 72.6-77C354 179 376 191 389 214.8zM247.7 8C104.7 8 0 123 0 256c0 138.4 113.6 248 247.6 248C377.5 504 496 403 496 256 496 118 389.4 8 247.6 8zm.8 450.8c-112.5 0-203.7-93-203.7-202.8 0-105.5 85.5-203.3 203.8-203.3A201.7 201.7 0 01451.3 256c0 121.7-99.7 202.9-202.9 202.9z'/%3E%3C/svg%3E");
- content: ' ';
- height: 160px;
- width: 160px;
- right: -30px;
- top: -45px;
- opacity: 0.1;
- }
- }
-
- .nexmoe-post-footer {
- background-color: #f5f6f5;
- padding: $gutter;
- margin: -($gutter);
- margin-top: 0;
- }
-}
-
-#nexmoe-content:after {
- clear: both;
- display: table;
- content: ' ';
-}
-
-@media screen and (max-width: 1024px) {
- #nexmoe-content {
- .nexmoe-primary {
- width: 100%;
- position: relative;
- min-height: 100vh;
- }
-
- .nexmoe-secondary {
- display: none;
- }
- }
-}
-
-@media screen and (min-width: 1024px) {
- body {
- padding-left: 0px;
- }
-
- #nexmoe-header .mdui-drawer-close {
- display: none;
-
- .nexmoe-avatar {
- padding: 16px;
- width: 80px;
- margin-left: 160px;
- margin-top: 8px;
- }
-
- .nexmoe-count {
- padding: 16px;
- width: 80px;
- margin-left: 160px;
- display: block;
- }
-
- .nexmoe-count div {
- display: block;
- margin-bottom: 10px;
- }
-
- .nexmoe-count div:last-child {
- margin-bottom: 0;
- }
-
- .mdui-list {
- margin-left: 160px;
- }
-
- .nexmoe-list-item {
- padding: 0 17px;
- color: #9ca2a8;
- }
-
- .mdui-list-item-icon~.mdui-list-item-content {
- margin-left: 32px;
- }
-
- .nexmoe-list {
- padding: 8px 10px;
- }
- }
-}
-
@keyframes shake-it {
0% {
text-shadow: 0 0 rgba(0, 255, 255, 0.5), 0 0 rgba(255, 0, 0, 0.5);
@@ -671,13 +133,6 @@ body.mdui-drawer-body-left {
right: 20px;
left: auto;
}
-
- #nexmoe-header .nexmoe-social a {
- margin: 5px;
- width: 44px;
- height: 44px;
- line-height: 44px;
- }
}
.nexmoe-toc {
From 8a8797f42ea654fbb6129b50e38a1c5dbdaa5ade Mon Sep 17 00:00:00 2001
From: Nexmoe <16796652+nexmoe@users.noreply.github.com>
Date: Sun, 19 Mar 2023 16:20:46 +0800
Subject: [PATCH 8/8] chore: layout body
---
include/config.js | 2 +-
include/dependency.js | 2 +-
layout/_layout/nexmoe/body.jsx | 33 +++++++++++++++++++++++++
layout/_layout/xiaoshu/body.jsx | 33 +++++++++++++++++++++++++
layout/_layout/xiaoshu/content.jsx | 7 +-----
layout/_layout/xiaoshu/footer.jsx | 6 +++--
layout/_layout/xiaoshu/header.jsx | 30 ++++++++++++++++++++++
layout/layout.jsx | 24 ++----------------
scripts/tag/links.js | 2 +-
source/css/_layout/nexmoe/index.styl | 3 ---
source/css/_layout/xiaoshu/content.styl | 13 ++++++++++
source/css/_layout/xiaoshu/footer.styl | 8 ++++++
source/css/_layout/xiaoshu/index.styl | 18 --------------
source/css/_partial/pagination.styl | 23 ++++++++---------
source/css/style.styl | 10 ++++++--
15 files changed, 147 insertions(+), 67 deletions(-)
create mode 100644 layout/_layout/nexmoe/body.jsx
create mode 100644 layout/_layout/xiaoshu/body.jsx
delete mode 100644 source/css/_layout/nexmoe/index.styl
create mode 100644 source/css/_layout/xiaoshu/content.styl
create mode 100644 source/css/_layout/xiaoshu/footer.styl
delete mode 100644 source/css/_layout/xiaoshu/index.styl
diff --git a/include/config.js b/include/config.js
index 0609757ec..a93ef9715 100644
--- a/include/config.js
+++ b/include/config.js
@@ -27,7 +27,7 @@ function hashConfigFile(cfgPath) {
function checkConfig(hexo) {
if (!process.argv.includes('--nexmoe-dont-check-config')) {
- logger.info('=== Checking theme configurations ===');
+ logger.info('[Nexmoe] Checking theme configurations');
const themeSiteCfg = path.join(hexo.base_dir, '_config.nexmoe.yml');
const themeDirCfg = path.join(hexo.theme_dir, '_config.yml');
diff --git a/include/dependency.js b/include/dependency.js
index 8d08e4ecf..38bd23453 100644
--- a/include/dependency.js
+++ b/include/dependency.js
@@ -20,7 +20,7 @@ module.exports = hexo => {
return false;
}
- logger.info('=== Checking package dependencies ===');
+ logger.info('[Nexmoe] Checking package dependencies');
const dependencies = Object.assign({}, packageInfo.dependencies);
const missingDeps = Object.keys(dependencies)
.filter(name => !checkDependency(name, dependencies[name]));
diff --git a/layout/_layout/nexmoe/body.jsx b/layout/_layout/nexmoe/body.jsx
new file mode 100644
index 000000000..7ee6be4fa
--- /dev/null
+++ b/layout/_layout/nexmoe/body.jsx
@@ -0,0 +1,33 @@
+const { Component } = require("inferno");
+
+module.exports = class extends Component {
+ render() {
+ const { partial } = this.props;
+ const Content = require(`./content`);
+ const Footer = require(`./footer`);
+
+ return (
+ <>
+
+
+
+
+ >
+ );
+ }
+};
diff --git a/layout/_layout/xiaoshu/body.jsx b/layout/_layout/xiaoshu/body.jsx
new file mode 100644
index 000000000..9f0ff376d
--- /dev/null
+++ b/layout/_layout/xiaoshu/body.jsx
@@ -0,0 +1,33 @@
+const { Component } = require("inferno");
+
+module.exports = class extends Component {
+ render() {
+ const { partial } = this.props;
+ const Header = require(`./header`);
+ const Content = require(`./content`);
+ const Footer = require(`./footer`);
+
+ return (
+ <>
+
+
+
+
+ >
+ );
+ }
+};
diff --git a/layout/_layout/xiaoshu/content.jsx b/layout/_layout/xiaoshu/content.jsx
index 6738ce0f1..7d8f6d070 100644
--- a/layout/_layout/xiaoshu/content.jsx
+++ b/layout/_layout/xiaoshu/content.jsx
@@ -4,11 +4,6 @@ module.exports = class extends Component {
render() {
const { body } = this.props;
- return (
-
- );
+ return
;
}
};
diff --git a/layout/_layout/xiaoshu/footer.jsx b/layout/_layout/xiaoshu/footer.jsx
index b091034ff..0cbfed41f 100644
--- a/layout/_layout/xiaoshu/footer.jsx
+++ b/layout/_layout/xiaoshu/footer.jsx
@@ -13,14 +13,16 @@ module.exports = class extends Component {
Hexo
- &{" "}
+ &
Nexmoe
- {theme.slotSidebar}
+
>
);
diff --git a/layout/_layout/xiaoshu/header.jsx b/layout/_layout/xiaoshu/header.jsx
index e69de29bb..0cbfed41f 100644
--- a/layout/_layout/xiaoshu/header.jsx
+++ b/layout/_layout/xiaoshu/header.jsx
@@ -0,0 +1,30 @@
+const { Component } = require("inferno");
+
+module.exports = class extends Component {
+ render() {
+ const { config, date, theme, __ } = this.props;
+
+ return (
+ <>
+
+ © {date(new Date(), "YYYY")}{" "}
+ {config.author || config.title}
+ {__("Powered by")}
+
+ Hexo
+
+ &
+
+ Nexmoe
+
+
+
+ >
+ );
+ }
+};
diff --git a/layout/layout.jsx b/layout/layout.jsx
index e6e9128cb..e2c853a51 100644
--- a/layout/layout.jsx
+++ b/layout/layout.jsx
@@ -7,8 +7,7 @@ module.exports = class extends Component {
const language = page.lang || page.language || config.language;
const layout = "nexmoe";
const bodyClass = layout === "nexmoe" ? "mdui-drawer-body-left" : "";
- const Content = require(`./_layout/${layout}/content`);
- const Footer = require(`./_layout/${layout}/footer`);
+ const Body = require(`./_layout/${layout}/body`);
return (
@@ -19,32 +18,13 @@ module.exports = class extends Component {
>
-
-
+
* {
+ margin-right: 8px;
+ float: left;
+ color: #999;
+ border-radius: 50%;
+ width: 36px;
+ height: 36px;
+ line-height: 36px;
+ background: #f5f6f5;
+}
+
.nexmoe-page-nav {
list-style: none;
color: #ddd;
@@ -16,14 +28,3 @@
box-shadow: 0 2px 12px var(--color-primary);
}
}
-
-.nexmoe-page-nav > * {
- margin-right: 8px;
- float: left;
- color: #999;
- border-radius: 50%;
- width: 36px;
- height: 36px;
- line-height: 36px;
- background-color: #f5f6f5;
-}
\ No newline at end of file
diff --git a/source/css/style.styl b/source/css/style.styl
index 5821fb3d4..1f4f784fa 100644
--- a/source/css/style.styl
+++ b/source/css/style.styl
@@ -1,7 +1,7 @@
$gutter = 24px;
:root {
- --gutter: 25px;
+ --gutter: 24px;
--radius: 13px;
--color-primary: #ff4e6a;
--color2: #ff761e;
@@ -23,7 +23,13 @@ $gutter = 24px;
@import '_partial/*';
@import '_index/*';
@import '_widget/*';
-@import '_layout/*/*';
+
+.xiaoshu {
+ @import '_layout/xiaoshu/*';
+}
+.nexmoe {
+ @import '_layout/nexmoe/*';
+}
*, *:after, *::before {
box-sizing: border-box;