From f85485e733e4c4c9ce9dc7101751673f568c5ca5 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Tue, 28 Feb 2023 16:47:38 +0800 Subject: [PATCH] doc: add theme-editor --- site/src/components/header.jsx | 204 -------------------------- site/src/layouts/BaseLayout.vue | 6 +- site/src/router/index.js | 8 + site/src/views/theme-editor/index.vue | 8 + 4 files changed, 19 insertions(+), 207 deletions(-) delete mode 100644 site/src/components/header.jsx create mode 100644 site/src/views/theme-editor/index.vue diff --git a/site/src/components/header.jsx b/site/src/components/header.jsx deleted file mode 100644 index f50f86c5c..000000000 --- a/site/src/components/header.jsx +++ /dev/null @@ -1,204 +0,0 @@ -import { isZhCN } from '../utils/util'; -import packageInfo from '../../../package.json'; -import logo from '../assets/logo.svg'; -import antDesignVue from '../assets/ant-design-vue.svg'; -import { SearchOutlined } from '@ant-design/icons-vue'; - -export default { - props: { - name: String, - searchData: Array, - }, - data() { - return { - value: null, - }; - }, - mounted() { - this.initDocSearch(this.$i18n.locale); - }, - methods: { - handleClose(key) { - localStorage.removeItem('jobs-notification-key'); - localStorage.setItem('jobs-notification-key', key); - }, - initDocSearch(locale) { - window.docsearch({ - apiKey: '92003c1d1d07beef165b08446f4224a3', - indexName: 'antdv', - inputSelector: '#search-box input', - algoliaOptions: { facetFilters: [isZhCN(locale) ? 'cn' : 'en'] }, - transformData(hits) { - hits.forEach(hit => { - hit.url = hit.url.replace('www.antdv.com', window.location.host); - hit.url = hit.url.replace('https:', window.location.protocol); - }); - return hits; - }, - debug: false, // Set debug to true if you want to inspect the dropdown - }); - }, - handleClick() { - const name = this.name; - const path = this.$route.path; - const newName = isZhCN(name) ? name.replace(/-cn\/?$/, '') : `${name}-cn`; - this.$router.push({ - path: path.replace(name, newName), - }); - this.$i18n.locale = isZhCN(name) ? 'en-US' : 'zh-CN'; - }, - onSelect(val) { - this.$router.push(val); - this.value = val; - }, - }, - render() { - const name = this.name; - const isCN = isZhCN(name); - const path = this.$route.path; - const selectedKeys = path === '/jobs/list-cn' ? ['jobs'] : ['components']; - return ( - - ); - }, -}; diff --git a/site/src/layouts/BaseLayout.vue b/site/src/layouts/BaseLayout.vue index 961c43997..95d5d981a 100644 --- a/site/src/layouts/BaseLayout.vue +++ b/site/src/layouts/BaseLayout.vue @@ -1,15 +1,15 @@