From 709aef66fba18c20bbce123f4a647cdf8c64df9a Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Thu, 17 Nov 2022 13:26:30 +0800 Subject: [PATCH] website: update footer. #102 --- package.json | 1 + scripts/create.mjs | 2 +- scripts/nodes/footer.mjs | 13 ++++++++----- scripts/style/style.css | 1 + 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 4d8098d0253..38ca75bee90 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ }, "keywords": [], "devDependencies": { + "@uiw/formatter": "^1.3.3", "@wcj/markdown-to-html": "^2.1.2", "chokidar": "^3.5.3", "fs-extra": "^10.1.0", diff --git a/scripts/create.mjs b/scripts/create.mjs index 00059f8f1af..fd3b0e7ff63 100644 --- a/scripts/create.mjs +++ b/scripts/create.mjs @@ -81,7 +81,7 @@ export function create(str = '', options = {}) { node.children = tocsData; } node.children.unshift(header(options)); - node.children.push(footer()); + node.children.push(footer(options)); node.children.push(anchorPoint()); } } diff --git a/scripts/nodes/footer.mjs b/scripts/nodes/footer.mjs index 19f943a8240..a76cb9a69b1 100644 --- a/scripts/nodes/footer.mjs +++ b/scripts/nodes/footer.mjs @@ -1,5 +1,10 @@ +import formatter from '@uiw/formatter'; -export function footer() { +export function footer(options = {}) { + const footerText = '© 2022 Kenny Wang.'; + if (options.isHome) { + footerText += ` Updated on ${formatter('YYYY/MM/DD HH:mm:ss', new Date())}`; + } return { type: 'element', tagName: 'footer', @@ -13,10 +18,8 @@ export function footer() { properties: { class: ['max-container'], }, - children: [ - { type: 'text', value: '© 2022 Kenny Wang, All rights reserved.' } - ], - } + children: [{ type: 'text', value: footerText }], + }, ], }; } diff --git a/scripts/style/style.css b/scripts/style/style.css index 3e6a27787ee..2676f2e9efa 100644 --- a/scripts/style/style.css +++ b/scripts/style/style.css @@ -1196,6 +1196,7 @@ body:not(.home) .h2wrap-body > .wrap:hover .h3wrap > h3 a::after { color: rgb(100 116 139/1); background-color: var(--color-canvas-subtle); text-align: center; + font-size: 0.75rem; } @media (min-width: 1024px) {