Skip to content

Commit

Permalink
fix: add offset for tooltip hover to avoid flick
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed Nov 7, 2024
1 parent b784d8a commit 1ecbd0b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 43 deletions.
18 changes: 0 additions & 18 deletions e2e/example.spec.ts

This file was deleted.

4 changes: 3 additions & 1 deletion e2e/theme-yun/categories.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ test.use({

test.describe('Categories Page', () => {
test('toggle categories', async ({ page }) => {
await page.goto('/categories?category=中文/分类/测试')
const curCategory = '中文/分类/测试'
await page.goto(`/categories?category=${curCategory}`)
await page.waitForSelector('.post-collapse-container')
// .post-item
await expect(page.locator('.post-item')).toHaveCount(1)
// first post
Expand Down
1 change: 1 addition & 0 deletions e2e/theme-yun/fm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ test.beforeEach(async ({ page }) => {
test.describe('Frontmatter', () => {
test('posted & edited time', async ({ page }) => {
await page.goto('/posts/hello-valaxy')
await page.waitForSelector('.post-meta')

await expect(page.locator('.post-time time')).toHaveCount(2)
await expect(page.locator('.post-time > .posted-time time')).toHaveText(/\d{4}-\d{2}-\d{2}/)
Expand Down
27 changes: 12 additions & 15 deletions packages/valaxy/client/components/ValaxyFootnoteTooltip.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
<script lang="ts">
import { PopperWrapper } from 'floating-vue'
const Component = ({
...PopperWrapper,
name: 'ValaxyFootnoteTooltip',
vPopperTheme: 'tooltip',
}) as unknown as typeof PopperWrapper
export default Component
<script setup lang="ts">
import { Tooltip } from 'floating-vue'
// distance offset for sup
</script>

<style scoped>
div .v-popper {
display: inline
}
</style>
<template>
<Tooltip class="inline-block" :distance="8">
<slot />

<template #popper>
<slot name="popper" />
</template>
</Tooltip>
</template>
12 changes: 3 additions & 9 deletions packages/valaxy/client/modules/floating-vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ import type { DefaultTheme, ValaxyConfig } from 'valaxy/types'
import type { ComputedRef } from 'vue'

export async function install({ app }: ViteSSGContext, config: ComputedRef<ValaxyConfig<DefaultTheme.Config>>) {
app.use(FloatingVue, Object.assign({
themes: {
tooltip: {
delay: {
show: 0,
},
},
},
}, config.value.siteConfig.floatingVue || {}))
// @see https://floating-vue.starpad.dev/guide/config#default-values
const defaultFloatingVueConfig = {}
app.use(FloatingVue, Object.assign(defaultFloatingVueConfig, config.value.siteConfig.floatingVue || {}))
}

1 comment on commit 1ecbd0b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://yun.valaxy.site as production
🚀 Deployed on https://672cce0e8c75e493d4cf6172--valaxy.netlify.app

Please sign in to comment.