Skip to content

Commit 8ed904d

Browse files
committed
💄(frontend) Use StyledLink for sub doc tree
Replace ButtonBox by StyledLink in DocSubPageItem so ctrl+click on the sub document title open a new browser tab Signed-off-by: Paul Vernin <paul.vernin@gmail.com>
1 parent 756cf82 commit 8ed904d

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to
1616
- ♿(frontend) use aria-haspopup menu on DropButton triggers #2126
1717
- ♿️(frontend) add contextual browser tab titles for docs routes #2120
1818
- ♿️(frontend) fix empty heading before section titles in HTML export #2125
19+
- 💄(frontend) Use StyledLink for sub doc tree #2100
1920

2021
### Fixed
2122

src/frontend/apps/impress/src/features/docs/doc-tree/components/DocSubPageItem.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useEffect, useRef, useState } from 'react';
1111
import { useTranslation } from 'react-i18next';
1212
import { css } from 'styled-components';
1313

14-
import { Box, BoxButton, Icon, Text } from '@/components';
14+
import { Box, Icon, StyledLink, Text } from '@/components';
1515
import { useCunninghamTheme } from '@/cunningham';
1616
import {
1717
Doc,
@@ -279,27 +279,25 @@ const DocSubPageItemContent = (props: TreeViewNodeProps<Doc>) => {
279279
buttonOptionRef={buttonOptionRef}
280280
/>
281281
</Box>
282-
<BoxButton
282+
<StyledLink
283+
href={`/docs/${doc.id}`}
283284
onClick={(e) => {
284285
e.stopPropagation();
286+
e.preventDefault();
285287
handleActivate();
286288
}}
287289
tabIndex={-1}
288-
$width="100%"
289-
$direction="row"
290-
$gap={spacingsTokens['xs']}
291-
$align="center"
292-
$minHeight="24px"
293290
data-testid={`doc-sub-page-item-${doc.id}`}
294291
aria-label={`${t('Open document {{title}}', { title: docTitle })}`}
295292
$css={css`
296-
text-align: left;
297-
min-width: 0;
293+
width: 100%;
298294
`}
299295
>
300296
<Box
301297
$direction="row"
302298
$align="center"
299+
$gap={spacingsTokens['xs']}
300+
$minHeight="24px"
303301
$css={css`
304302
display: flex;
305303
flex-direction: row;
@@ -322,7 +320,7 @@ const DocSubPageItemContent = (props: TreeViewNodeProps<Doc>) => {
322320
/>
323321
)}
324322
</Box>
325-
</BoxButton>
323+
</StyledLink>
326324
</TreeViewItem>
327325
</Box>
328326
);

0 commit comments

Comments
 (0)