Skip to content

Commit

Permalink
Merge pull request #267 from Mister-Hope/master
Browse files Browse the repository at this point in the history
docs: update docs
  • Loading branch information
kings1990 authored Jul 31, 2023
2 parents 885d3bc + b50ea5c commit f875596
Show file tree
Hide file tree
Showing 102 changed files with 2,072 additions and 2,020 deletions.
2 changes: 0 additions & 2 deletions docs/.vuepress/client.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { defineClientConfig } from "@vuepress/client";
import { ColorIcon } from "./components/ColorIcon.js";
import RfrSlot from "./layouts/RfrSlot.vue";

export default defineClientConfig({
enhance: ({ app }) => {
app.component("ColorIcon", ColorIcon);
},
layouts: { RfrSlot},
});
2 changes: 1 addition & 1 deletion docs/.vuepress/components/ColorIcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export const ColorIcon: FunctionalComponent<{ icon: string }> = ({ icon }) =>
h(
"svg",
{ class: "icon svg-icon", "aria-hidden": "true" },
h("use", { "xlink:href": `#icon-${icon}` })
h("use", { "xlink:href": `#icon-${icon}` }),
);
7 changes: 7 additions & 0 deletions docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,11 @@ export default defineUserConfig({
],

pagePatterns: ["**/*.md", "!*.snippet.md", "!.vuepress", "!node_modules"],

alias: {
"@theme-hope/layouts/Layout": path.resolve(
__dirname,
"./layouts/Layout.vue",
),
},
});
75 changes: 75 additions & 0 deletions docs/.vuepress/layouts/Layout.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<script setup lang="ts">
import { usePageData, usePageFrontmatter } from "@vuepress/client";
import { ref, watch } from "vue";
import { useRoute } from "vue-router";
import CommonWrapper from "@theme-hope/components/CommonWrapper";
import HomePage from "@theme-hope/components/HomePage";
import NormalPage from "@theme-hope/components/NormalPage";
import SkipLink from "@theme-hope/components/SkipLink";
import FadeSlideY from "@theme-hope/components/transitions/FadeSlideY";
import type { ThemePageFrontmatter } from "../../shared/index.js";
const page = usePageData();
const frontmatter = usePageFrontmatter<ThemePageFrontmatter>();
const route = useRoute();
const sidebarTopArray = [
`<a href="https://jetbrains.com" target="_blank">
<img className="no-zoom" height="50px" width="220px" src="/img/IntelliJ_IDEA.svg">
</a>`,
];
const sidebarContent = ref("");
function shuffle(arr) {
var l = arr.length;
var index, temp;
while (l > 0) {
index = Math.floor(Math.random() * l);
temp = arr[l - 1];
arr[l - 1] = arr[index];
arr[index] = temp;
l--;
}
return arr;
}
watch(
() => route.path,
() => {
if (route.path.startsWith("/en/")) {
sidebarContent.value = "";
return;
}
shuffle(sidebarTopArray);
sidebarContent.value = `\
<div style="width:230px;margin:0 auto">
${sidebarTopArray.slice(0, 4).join("\n ")}
<br/>
<span style='color: grey;font-size: 11px;'>广告采用随机方式显示</span>
<span style='float: right;'>
<a href='/fast-request/guide/sponsor.html' style='color: var(--theme-color);font-size: 11px;font-weight: bolder;'>成为赞助商</a>
</span>
</div>
`;
},
);
</script>
<template>
<SkipLink />
<CommonWrapper>
<template #default>
<HomePage v-if="frontmatter.home" />
<FadeSlideY v-else>
<NormalPage :key="page.path" />
</FadeSlideY>
</template>
<template v-if="!frontmatter.home" #sidebarTop>
<div v-html="sidebarContent" />
</template>
</CommonWrapper>
</template>
91 changes: 0 additions & 91 deletions docs/.vuepress/layouts/RfrSlot.vue

This file was deleted.

8 changes: 4 additions & 4 deletions docs/.vuepress/navbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export const zhNavbar = navbar([
},
{
text: "🔥 团队协作",
link: "/guide/teamwork",
// icon: "teamwork",
link: "/guide/teamwork",
},
{
text: "🎯 群聊",
Expand All @@ -102,9 +102,9 @@ export const zhNavbar = navbar([
link: "/guide/faq",
},
{
text: "Java资源",
link: "/guide/java",
},
text: "Java资源",
link: "/guide/java",
},
{
text: "更多",
children: ["/guide/link", "/guide/sponsorList", "/guide/activity"],
Expand Down
Loading

0 comments on commit f875596

Please sign in to comment.