mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-19 17:15:24 +00:00
Fix display of cover when TOC is hidden (#328)
* Add visual tests for page options * Fix the case of a landing page * Fix height of the aside when page has a cover * Remove some visual tests
This commit is contained in:
+21
-22
@@ -77,17 +77,6 @@ const testCases: TestsCase[] = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'GitBook Examples',
|
||||
baseUrl: 'https://examples.gitbook.com',
|
||||
tests: [
|
||||
{
|
||||
name: 'Landing page',
|
||||
url: '',
|
||||
run: waitForCookiesDialog,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Snyk',
|
||||
baseUrl: 'https://docs.snyk.io',
|
||||
@@ -99,17 +88,6 @@ const testCases: TestsCase[] = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Rocket.Chat',
|
||||
baseUrl: 'https://docs.rocket.chat',
|
||||
tests: [
|
||||
{
|
||||
name: 'Home',
|
||||
url: '',
|
||||
run: waitForCookiesDialog,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Versioning',
|
||||
baseUrl: 'https://gitbook.gitbook.io/test-1-1/',
|
||||
@@ -221,6 +199,27 @@ const testCases: TestsCase[] = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Page options',
|
||||
baseUrl: 'https://gitbook.gitbook.io/test-1-1/',
|
||||
tests: [
|
||||
{
|
||||
name: 'With cover',
|
||||
url: 'page-options/page-with-cover',
|
||||
run: waitForCookiesDialog,
|
||||
},
|
||||
{
|
||||
name: 'With hero cover',
|
||||
url: 'page-options/page-with-hero-cover',
|
||||
run: waitForCookiesDialog,
|
||||
},
|
||||
{
|
||||
name: 'With cover and no TOC',
|
||||
url: 'page-options/page-with-cover-and-no-toc',
|
||||
run: waitForCookiesDialog,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Customization',
|
||||
baseUrl: 'https://gitbook.gitbook.io/test-1-1/',
|
||||
|
||||
@@ -46,7 +46,8 @@ export async function PageAside(props: {
|
||||
'sticky',
|
||||
'py-8',
|
||||
'break-anywhere', // To prevent long words in headings from breaking the layout
|
||||
withHeaderOffset ? 'lg:h-[calc(100vh_-_4rem)]' : 'lg:h-[100vh]',
|
||||
'lg:h-full',
|
||||
withHeaderOffset ? 'lg:max-h-[calc(100vh_-_4rem)]' : 'lg:max-h-[100vh]',
|
||||
withHeaderOffset ? 'top-16' : 'top-0',
|
||||
'h-[100vh]',
|
||||
|
||||
|
||||
@@ -18,17 +18,22 @@ export async function PageCover(props: {
|
||||
cover: RevisionPageDocumentCover;
|
||||
context: ContentRefContext;
|
||||
}) {
|
||||
const { as, cover, context } = props;
|
||||
const { as, page, cover, context } = props;
|
||||
const resolved = cover.ref ? await resolveContentRef(cover.ref, context) : null;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={tcls(
|
||||
'overflow-hidden',
|
||||
'-mx-4',
|
||||
// Negative margin to balance the container padding
|
||||
'-mx-4',
|
||||
as === 'full'
|
||||
? ['sm:-mx-6', 'md:-mx-8', 'lg:ml-0', '-lg:mr-8']
|
||||
? [
|
||||
'sm:-mx-6',
|
||||
'md:-mx-8',
|
||||
'-lg:mr-8',
|
||||
page.layout.tableOfContents ? 'lg:ml-0' : null,
|
||||
]
|
||||
: ['sm:mx-auto', 'max-w-3xl', 'sm:rounded-md', 'mb-8'],
|
||||
)}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user