/
githubmirror
/
hexo
Обзор
Документация
Войти
/
githubmirror
/
hexo
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
lib/plugins/helper/search_form.ts
18 строк
799 B
D-Sketon
refactor: migrate typescript (#5417)
03 мар 2024, 11:04
Не верифицирован
03 мар 2024, 11:04
3c7729d
Код
Авторство
О чём код?
import moize from 'moize'; import type { LocalsType } from '../../types'; interface Options { class?: string; text?: string | null; button?: string | boolean; } function searchFormHelper(this: LocalsType, options: Options = {}) { const { config } = this; const className = options.class || 'search-form'; const { text = 'Search', button } = options; return `<form action="//google.com/search" method="get" accept-charset="UTF-8" class="${className}"><input type="search" name="q" class="${className}-input"${text ? ` placeholder="${text}"` : ''}>${button ? `<button type="submit" class="${className}-submit">${typeof button === 'string' ? button : text}</button>` : ''}<input type="hidden" name="sitesearch" value="${config.url}"></form>`; } export = moize.deep(searchFormHelper);