mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-17 20:51:21 +08:00
website: add search feature. #32
This commit is contained in:
@ -4,9 +4,45 @@ import { getSVGNode } from '../utils/getSVGNode.mjs';
|
||||
import { darkMode } from '../utils/darkMode.mjs';
|
||||
|
||||
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 header({ homePath, githubURL = '' }) {
|
||||
const svgNode = getSVGNode(ICONS_PATH);
|
||||
const svgSearchNode = getSVGNode(ICONS_SEARCH_PATH);
|
||||
const data = [
|
||||
{
|
||||
menu: true,
|
||||
href: 'javascript:void(0);',
|
||||
class: ['searchbtn'],
|
||||
id: 'searchbtn',
|
||||
children: [
|
||||
...svgSearchNode,
|
||||
{
|
||||
type: 'element',
|
||||
tagName: 'span',
|
||||
children: [
|
||||
{
|
||||
type: 'text',
|
||||
value: '搜索',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'element',
|
||||
tagName: 'span',
|
||||
children: [
|
||||
{
|
||||
type: 'text',
|
||||
value: '⌘',
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
value: 'K',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
menu: true,
|
||||
href: githubURL,
|
||||
|
Reference in New Issue
Block a user