From b37acf3138d3afa63a4640ef0969bb79e9ca07de Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Tue, 17 Sep 2024 17:35:24 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84(frontend)=20improve=20ui=20table?= =?UTF-8?q?=20of=20contents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - keep correctly the text on the left side - improve accuracy highlightment heading when scrolling - display full heading text when text transform is applied - fix typo --- .../app-impress/doc-table-content.spec.ts | 12 ++-- .../apps/impress/src/components/Panel.tsx | 4 +- .../docs/doc-header/components/DocToolBox.tsx | 2 +- .../doc-table-content/components/Heading.tsx | 1 + .../components/TableContent.tsx | 55 ++++++++++++------- 5 files changed, 47 insertions(+), 27 deletions(-) diff --git a/src/frontend/apps/e2e/__tests__/app-impress/doc-table-content.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/doc-table-content.spec.ts index 3cf87a98..4ad46ec1 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/doc-table-content.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/doc-table-content.spec.ts @@ -20,7 +20,7 @@ test.describe('Doc Table Content', () => { await page.getByLabel('Open the document options').click(); await page .getByRole('button', { - name: 'Table of content', + name: 'Table of contents', }) .click(); @@ -30,6 +30,8 @@ test.describe('Doc Table Content', () => { await editor.locator('.bn-block-outer').last().fill('/'); await page.getByText('Heading 1').click(); await page.keyboard.type('Hello World'); + await editor.getByText('Hello').dblclick(); + await page.getByRole('button', { name: 'Strike' }).click(); await page.locator('.bn-block-outer').last().click(); @@ -40,7 +42,7 @@ test.describe('Doc Table Content', () => { await editor.locator('.bn-block-outer').last().fill('/'); await page.getByText('Heading 2').click(); - await page.keyboard.type('Super World'); + await page.keyboard.type('Super World', { delay: 100 }); await page.locator('.bn-block-outer').last().click(); @@ -58,15 +60,15 @@ test.describe('Doc Table Content', () => { const another = panel.getByText('Another World'); await expect(hello).toBeVisible(); - await expect(hello).toHaveCSS('font-size', '19.2px'); + await expect(hello).toHaveCSS('font-size', /19/); await expect(hello).toHaveAttribute('aria-selected', 'true'); await expect(superW).toBeVisible(); - await expect(superW).toHaveCSS('font-size', '16px'); + await expect(superW).toHaveCSS('font-size', /16/); await expect(superW).toHaveAttribute('aria-selected', 'false'); await expect(another).toBeVisible(); - await expect(another).toHaveCSS('font-size', '12.8px'); + await expect(another).toHaveCSS('font-size', /12/); await expect(another).toHaveAttribute('aria-selected', 'false'); await hello.click(); diff --git a/src/frontend/apps/impress/src/components/Panel.tsx b/src/frontend/apps/impress/src/components/Panel.tsx index 7335cb08..b154ef6f 100644 --- a/src/frontend/apps/impress/src/components/Panel.tsx +++ b/src/frontend/apps/impress/src/components/Panel.tsx @@ -36,10 +36,10 @@ export const Panel = ({ $width="100%" $maxWidth="20rem" $position="sticky" - $maxHeight="96vh" + $maxHeight="99vh" $height="100%" $css={` - top: 2vh; + top: 0vh; transition: ${transition}; ${ !isOpen && diff --git a/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx b/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx index a6412b73..fea1033b 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx @@ -91,7 +91,7 @@ export const DocToolBox = ({ doc }: DocToolBoxProps) => { icon={summarize} size="small" > - {t('Table of content')} + {t('Table of contents')}