From cf8ac29a841799f00c3d99fbaff5fbca966d8112 Mon Sep 17 00:00:00 2001
From: Nofated <49985975+Nofated095@users.noreply.github.com>
Date: Sat, 17 Sep 2022 20:35:56 +0800
Subject: [PATCH] Create footer.jsx
---
theme/icarus/layout/common/footer.jsx | 92 +++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
create mode 100644 theme/icarus/layout/common/footer.jsx
diff --git a/theme/icarus/layout/common/footer.jsx b/theme/icarus/layout/common/footer.jsx
new file mode 100644
index 0000000..0c7450e
--- /dev/null
+++ b/theme/icarus/layout/common/footer.jsx
@@ -0,0 +1,92 @@
+const { Component } = require('inferno');
+const { cacheComponent } = require('hexo-component-inferno/lib/util/cache');
+
+class Footer extends Component {
+ render() {
+ const {
+ logo,
+ logoUrl,
+ siteUrl,
+ siteTitle,
+ siteYear,
+ author,
+ links,
+ showVisitorCounter,
+ visitorCounterTitle
+ } = this.props;
+
+ let footerLogo = '';
+ if (logo) {
+ if (logo.text) {
+ footerLogo = logo.text;
+ } else {
+ footerLogo =
;
+ }
+ } else {
+ footerLogo = siteTitle;
+ }
+
+ return ;
+ }
+}
+
+module.exports = cacheComponent(Footer, 'common.footer', props => {
+ const { config, helper } = props;
+ const { url_for, _p, date } = helper;
+ const { logo, title, author, footer, plugins } = config;
+
+ const links = {};
+ if (footer && footer.links) {
+ Object.keys(footer.links).forEach(name => {
+ const link = footer.links[name];
+ links[name] = {
+ url: url_for(typeof link === 'string' ? link : link.url),
+ icon: link.icon
+ };
+ });
+ }
+
+ return {
+ logo,
+ logoUrl: url_for(logo),
+ siteUrl: url_for('/'),
+ siteTitle: title,
+ siteYear: date(new Date(), 'YYYY'),
+ author,
+ links,
+ showVisitorCounter: plugins && plugins.busuanzi === true,
+ visitorCounterTitle: _p('plugin.visitor_count', '0')
+ };
+});