mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-16 20:21:22 +08:00
feat: add dark/light theme.
This commit is contained in:
@ -1,18 +1,22 @@
|
||||
import path from 'path';
|
||||
import { github, editor } from './logo.mjs';
|
||||
import { getSVGNode } from '../utils/getSVGNode.mjs';
|
||||
import { darkMode } from '../utils/darkMode.mjs';
|
||||
|
||||
const ICONS_PATH = path.resolve(process.cwd(), 'scripts/assets/quickreference.svg')
|
||||
export function header({ homePath, githubURL = '' }) {
|
||||
const svgNode = getSVGNode(ICONS_PATH)
|
||||
const data = [
|
||||
{
|
||||
menu: true,
|
||||
href: githubURL,
|
||||
target: '__blank',
|
||||
label: '编辑',
|
||||
children: [editor]
|
||||
},
|
||||
...darkMode(),
|
||||
{
|
||||
menu: true,
|
||||
href: 'https://github.com/jaywcjlove/reference',
|
||||
target: '__blank',
|
||||
children: [github]
|
||||
@ -59,7 +63,8 @@ export function header({ homePath, githubURL = '' }) {
|
||||
properties: {
|
||||
class: ['menu'],
|
||||
},
|
||||
children: data.map(({ href, label, children = [], ...props }) => {
|
||||
children: data.map(({ href, label, menu, children = [], ...props }) => {
|
||||
if (!menu) return { children, ...props };
|
||||
const childs = {
|
||||
type: 'element',
|
||||
tagName: 'a',
|
||||
|
Reference in New Issue
Block a user