Skip to content

Commit

Permalink
feat(doc): update doc style (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahoo-Wang authored Jan 15, 2025
1 parent 9cf545a commit b406e4a
Show file tree
Hide file tree
Showing 5 changed files with 2,290 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/document-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:

- name: Build VitePress site
working-directory: documentation
run: npm add -D vitepress && npm run docs:build
run: yarn add -D vitepress && yarn run docs:build

- name: Deploy to gh-pages
uses: crazy-max/ghaction-github-pages@v4
Expand All @@ -66,7 +66,7 @@ jobs:
working-directory: documentation
env:
SITE_BASE: /cosid/
run: npm add -D vitepress && npm run docs:build
run: yarn add -D vitepress && yarn run docs:build

- name: Deploy to gh-pages-with-site-base
uses: crazy-max/ghaction-github-pages@v4
Expand Down
127 changes: 127 additions & 0 deletions documentation/docs/.vitepress/theme/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/*
* Copyright [2021-present] [ahoo wang <[email protected]> (https://github.com/Ahoo-Wang)].
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

:root {
--vp-c-default-1: var(--vp-c-gray-1);
--vp-c-default-2: var(--vp-c-gray-2);
--vp-c-default-3: var(--vp-c-gray-3);
--vp-c-default-soft: var(--vp-c-gray-soft);

--vp-c-brand-1: var(--vp-c-indigo-1);
--vp-c-brand-2: var(--vp-c-indigo-2);
--vp-c-brand-3: var(--vp-c-indigo-3);
--vp-c-brand-soft: var(--vp-c-indigo-soft);

--vp-c-tip-1: var(--vp-c-brand-1);
--vp-c-tip-2: var(--vp-c-brand-2);
--vp-c-tip-3: var(--vp-c-brand-3);
--vp-c-tip-soft: var(--vp-c-brand-soft);

--vp-c-warning-1: var(--vp-c-yellow-1);
--vp-c-warning-2: var(--vp-c-yellow-2);
--vp-c-warning-3: var(--vp-c-yellow-3);
--vp-c-warning-soft: var(--vp-c-yellow-soft);

--vp-c-danger-1: var(--vp-c-red-1);
--vp-c-danger-2: var(--vp-c-red-2);
--vp-c-danger-3: var(--vp-c-red-3);
--vp-c-danger-soft: var(--vp-c-red-soft);
}

/**
* Component: Button
* -------------------------------------------------------------------------- */

:root {
--vp-button-brand-border: transparent;
--vp-button-brand-text: var(--vp-c-white);
--vp-button-brand-bg: var(--vp-c-brand-3);
--vp-button-brand-hover-border: transparent;
--vp-button-brand-hover-text: var(--vp-c-white);
--vp-button-brand-hover-bg: var(--vp-c-brand-2);
--vp-button-brand-active-border: transparent;
--vp-button-brand-active-text: var(--vp-c-white);
--vp-button-brand-active-bg: var(--vp-c-brand-1);
}

/**
* Component: Home
* -------------------------------------------------------------------------- */

:root {
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(
120deg,
#bd34fe 30%,
#41d1ff
);

--vp-home-hero-image-background-image: linear-gradient(
-45deg,
#bd34fe 50%,
#47caff 50%
);
--vp-home-hero-image-filter: blur(44px);
}

@media (min-width: 640px) {
:root {
--vp-home-hero-image-filter: blur(56px);
}
}

@media (min-width: 960px) {
:root {
--vp-home-hero-image-filter: blur(68px);
}
}

/**
* Component: Custom Block
* -------------------------------------------------------------------------- */

:root {
--vp-custom-block-tip-border: transparent;
--vp-custom-block-tip-text: var(--vp-c-text-1);
--vp-custom-block-tip-bg: var(--vp-c-brand-soft);
--vp-custom-block-tip-code-bg: var(--vp-c-brand-soft);
}

/**
* Component: Algolia
* -------------------------------------------------------------------------- */

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

.medium-zoom-image {
z-index: 9999 !important;
}

.main img {
display: block;
margin-left: auto;
margin-right: auto;
}

.main img {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2),
0 6px 20px rgba(0, 0, 0, 0.19);
border-radius: 8px;
}

html.dark .main img {
box-shadow: 0 4px 8px rgba(255, 255, 255, 0.1),
0 6px 20px rgba(255, 255, 255, 0.1);
}
35 changes: 35 additions & 0 deletions documentation/docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright [2021-present] [ahoo wang <[email protected]> (https://github.com/Ahoo-Wang)].
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import DefaultTheme from 'vitepress/theme'
import { onMounted, watch, nextTick } from 'vue'
import { useRoute } from 'vitepress'
import mediumZoom from 'medium-zoom'
import './global.css'

export default {
...DefaultTheme,
setup() {
const route = useRoute()
const initZoom = () => {
mediumZoom('.main img', { background: 'var(--vp-c-bg)' })
}
onMounted(() => {
initZoom()
})
watch(
() => route.path,
() => nextTick(() => initZoom())
)
},
}
9 changes: 6 additions & 3 deletions documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
"author": "ahoo wang",
"license": "Apache 2.0",
"devDependencies": {
"mermaid": "^10.6.1",
"vitepress": "^1.0.0-rc.33",
"vitepress-plugin-mermaid": "^2.0.16"
"mermaid": "^11.4.1",
"vitepress": "^1.5.0",
"vitepress-plugin-mermaid": "^2.0.17"
},
"dependencies": {
"medium-zoom": "^1.1.0"
}
}
Loading

0 comments on commit b406e4a

Please sign in to comment.