Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(doc): add algolia search #447

Merged
merged 5 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ coverage
.history

# Log files
.pnpm-debug.log*
.pnpm-debug.log*
cache
32 changes: 14 additions & 18 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { defineConfig } from "vitepress";
import { version } from "../../packages/wujie-core/package.json";
import path from "path";
const ogDescription = "极致的微前端框架";
const ogImage = "https://wujie-micro.github.io/doc/wujie.png";
const ogTitle = "无界";
const ogUrl = "https://wujie-micro.github.io/doc/";
const base = process.env.NODE_ENV === "production" ? "/doc/" : "";
const base = "/doc/";

export default defineConfig({
title: "无界",
description: "极致的微前端框架",
title: ogTitle,
description: ogDescription,
base,
head: [
["link", { rel: "icon", href: `${base}/favicon.ico` }],
Expand All @@ -31,14 +30,11 @@ export default defineConfig({
},
lastUpdatedText: "最近更新时间",
socialLinks: [{ icon: "github", link: "https://github.com/Tencent/wujie" }],
// algolia: {
// appId: "",
// apiKey: "",
// indexName: "wujie",
// searchParameters: {
// facetFilters: ["tags:en"],
// },
// },
algolia: {
appId: "QMIAJMDLL1",
apiKey: "4eaef57a0122ce0454d3aed08f822178",
indexName: "wujie-microio",
},

footer: {
message: "Released the MIT License.",
Expand Down Expand Up @@ -82,7 +78,7 @@ export default defineConfig({
"/guide/": [
{
text: "入门",
collapsible: true,
collapsed: true,
items: [
{
text: "介绍",
Expand All @@ -100,7 +96,7 @@ export default defineConfig({
},
{
text: "指南",
collapsible: true,
collapsed: true,
items: [
{
text: "预加载",
Expand Down Expand Up @@ -150,7 +146,7 @@ export default defineConfig({
},
{
text: "项目实战",
collapsible: true,
collapsed: true,
items: [
{
text: "vue主应用",
Expand All @@ -166,7 +162,7 @@ export default defineConfig({
"/api/": [
{
text: "主应用",
collapsible: true,
collapsed: true,
items: [
{
text: "bus",
Expand All @@ -192,7 +188,7 @@ export default defineConfig({
},
{
text: "子应用",
collapsible: true,
collapsed: true,
items: [
{
text: "wujie",
Expand All @@ -205,7 +201,7 @@ export default defineConfig({
"/pack/": [
{
text: "框架封装",
collapsible: true,
collapsed: true,
items: [
{
text: "Vue组件封装",
Expand Down
1 change: 1 addition & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Theme from "vitepress/theme";
import wujieHome from "./components/wujie-home.vue";
import { h } from "vue";
import "./styles/vars.css";
import "./styles/DocSearch.css";

const inBrowser = typeof window !== "undefined";
export default {
Expand Down
70 changes: 70 additions & 0 deletions docs/.vitepress/theme/styles/DocSearch.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
:root {
--vp-z-index-doc-search: 1000 !important;
--vp-doc-search-background-color: linear-gradient(45deg, var(--color1), var(--color1), var(--color2), var(--color1));
}

.DocSearch {
--docsearch-primary-color: var(--vp-c-brand) !important;
}

.DocSearch-Container {
z-index: var(--vp-z-index-doc-search);
}

.DocSearch-Button {
font-weight: bold;
width: 18vw;
display: flex;
justify-content: space-between;
border: none;
outline: none;
color: #fff;
cursor: pointer;
position: relative;
background-color: var(--vp-c-bg-soft-mute);
z-index: 0;
border-radius: 10px;
}

.DocSearch-Button:before {
content: "";
background: var(--vp-doc-search-background-color);
position: absolute;
top: -2px;
left: -2px;
background-size: 400%;
z-index: -1;
filter: blur(4px);
width: calc(100% + 4px);
height: calc(100% + 4px);
animation: RhyshaKachari-glowing 20s linear infinite;
opacity: 1;
transition: opacity 0.3s ease-in-out;
border-radius: 10px;
}

.DocSearch-Button:after {
z-index: -1;
content: "";
position: absolute;
width: 100%;
height: 100%;
background-color: var(--vp-c-bg-soft-mute);
left: 0;
top: 0;
border-radius: 10px;
}

@keyframes RhyshaKachari-glowing {
0% {
background-position: 0 0;
}

50% {
background-position: 400% 0;
}

100% {
background-position: 0 0;
}
}
4 changes: 0 additions & 4 deletions docs/.vitepress/theme/styles/vars.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@
* Component: Algolia
* -------------------------------------------------------------------------- */

.DocSearch {
--docsearch-primary-color: var(--vp-c-brand) !important;
}

.link {
padding: 4px 0;
}
Expand Down
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"private": true,
"scripts": {
"docs:dev": "vitepress dev --open",
"docs:dev": "vitepress dev --open --port=9765",
"docs:build": "vitepress build",
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand All @@ -14,7 +14,7 @@
"license": "ISC",
"devDependencies": {
"vite": "3.0.9",
"vitepress": "1.0.0-alpha.9"
"vitepress": "1.0.0-alpha.60"
},
"dependencies": {
"@vue/theme": "^1.2.2",
Expand Down
2 changes: 1 addition & 1 deletion docs/wujie/components/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const wujieList = [
},
{
name: "React",
url: "https://beta.reactjs.org/",
url: "https://react.dev/",
},
{
name: "Vercel",
Expand Down
Loading