mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-17 20:51:21 +08:00
website: custom nav menus. #102
This commit is contained in:
@ -1,11 +1,29 @@
|
||||
import path from 'path';
|
||||
import { github, editor } from './logo.mjs';
|
||||
import * as dotenv from 'dotenv';
|
||||
import { github, editor, home } from './logo.mjs';
|
||||
import { getSVGNode } from '../utils/getSVGNode.mjs';
|
||||
import { darkMode } from '../utils/darkMode.mjs';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const ICONS_PATH = path.resolve(process.cwd(), 'scripts/assets/quickreference.svg');
|
||||
const ICONS_SEARCH_PATH = path.resolve(process.cwd(), 'scripts/assets/search.svg');
|
||||
|
||||
export function getReferrals() {
|
||||
const url = process.env.REF_URL;
|
||||
const label = process.env.REF_LABEL;
|
||||
if (!url || !label) return [];
|
||||
return [
|
||||
{
|
||||
menu: true,
|
||||
href: url,
|
||||
target: '__blank',
|
||||
label: label,
|
||||
children: [home],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export function header({ homePath, githubURL = '', isHome } = {}) {
|
||||
const svgNode = getSVGNode(ICONS_PATH);
|
||||
const svgSearchNode = getSVGNode(ICONS_SEARCH_PATH);
|
||||
@ -43,6 +61,7 @@ export function header({ homePath, githubURL = '', isHome } = {}) {
|
||||
},
|
||||
],
|
||||
},
|
||||
...getReferrals(),
|
||||
{
|
||||
menu: true,
|
||||
href: githubURL,
|
||||
|
Reference in New Issue
Block a user