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

fix(theme): show outline even without sidebar #1189

Merged
merged 2 commits into from
Aug 17, 2022
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
10 changes: 5 additions & 5 deletions examples/minimal/__test__/content.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ describe('render corrent content', () => {
})

test('main content', async () => {
const h1Locator = await page.locator('h1')
const h2Locator = await page.locator('h2')
const pLocator = await page.locator('.Layout p')
const h1Locator = page.locator('h1')
const h2Locator = page.locator('h2')
const pLocator = page.locator('.Layout p')

const [h1Contents, h2Conetents, pContents] = await Promise.all([
h1Locator.allTextContents(),
Expand All @@ -28,11 +28,11 @@ describe('render corrent content', () => {
})

test('outline', async () => {
const outlineLinksLocator = await page.locator(
const outlineLinksLocator = page.locator(
'.VPDocAsideOutline .root .outline-link'
)

const outlineLinksCount = await outlineLinksLocator.count()
expect(outlineLinksCount).toEqual(0)
expect(outlineLinksCount).toEqual(4)
})
})
4 changes: 0 additions & 4 deletions src/client/theme-default/components/VPDoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ const pageName = computed(() =>
max-width: 992px;
}

.VPDoc:not(.has-sidebar) .aside {
display: block;
}

.VPDoc:not(.has-sidebar) .content {
max-width: 752px;
}
Expand Down
8 changes: 2 additions & 6 deletions src/client/theme-default/composables/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@ export function useSidebar() {
})

const hasAside = computed(() => {
if (
frontmatter.value.layout !== 'home' &&
frontmatter.value.aside === false
return (
frontmatter.value.layout !== 'home' && frontmatter.value.aside !== false
)
return false

return hasSidebar.value
})

function open() {
Expand Down