reference/scripts/nodes/footer.mjs

29 lines
695 B
JavaScript
Raw Normal View History

2022-11-17 13:26:30 +08:00
import formatter from '@uiw/formatter';
2022-09-26 22:14:52 +08:00
2022-11-17 13:26:30 +08:00
export function footer(options = {}) {
2022-11-17 13:28:01 +08:00
let footerText = '© 2022 Kenny Wang.';
2022-11-17 13:26:30 +08:00
if (options.isHome) {
const now = new Date();
const utc = now.getTime() + now.getTimezoneOffset() * 60000;
const cst = new Date(utc + 3600000 * 8);
footerText += ` Updated on ${formatter('YYYY/MM/DD HH:mm:ss', cst)}`;
2022-11-17 13:26:30 +08:00
}
2022-09-26 22:14:52 +08:00
return {
type: 'element',
tagName: 'footer',
properties: {
2022-09-28 13:35:52 +08:00
class: 'footer-wrap',
2022-09-26 22:14:52 +08:00
},
children: [
{
type: 'element',
tagName: 'footer',
properties: {
class: ['max-container'],
},
2022-11-17 13:26:30 +08:00
children: [{ type: 'text', value: footerText }],
},
2022-09-26 22:14:52 +08:00
],
};
}