Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
Implement #69
Browse files Browse the repository at this point in the history
  • Loading branch information
IMB11 committed Dec 12, 2023
1 parent f33a769 commit 285a342
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
20 changes: 17 additions & 3 deletions .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// https://vitepress.dev/guide/custom-theme
import { h } from 'vue'
import type { Theme } from 'vitepress'
import { h, nextTick, onMounted, watch } from 'vue'
import { useRoute, type Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import mediumZoom from 'medium-zoom';
import './style.css'

export default {
Expand All @@ -13,5 +14,18 @@ export default {
},
enhanceApp({ app, router, siteData }) {
// ...
}
},
setup() {
const route = useRoute();
const initZoom = () => {
mediumZoom('.main img', { background: 'var(--vp-c-bg)' });
};
onMounted(() => {
initZoom();
});
watch(
() => route.path,
() => nextTick(() => initZoom())
);
},
} satisfies Theme
8 changes: 8 additions & 0 deletions .vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@
background-color: var(--vp-c-bg-alt);
}

.medium-zoom-overlay {
z-index: 10000;
}

.medium-zoom-image {
z-index: 10001;
}

.VPNavBar:not(.top):not(.has-sidebar) {
border-bottom: none !important;
animation: nav-box-shadow 200ms ease-out forwards;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"vue": "^3.3.11"
},
"dependencies": {
"medium-zoom": "^1.1.0",
"vitepress": "1.0.0-rc.31"
}
}
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 285a342

Please sign in to comment.