Skip to content

Commit 5aaacc0

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 c4c6c22 commit 5aaacc0

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

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

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

12-
import { Box, BoxButton, Icon, Text } from '@/components';
12+
import { Box, Icon, StyledLink, Text } from '@/components';
1313
import { useCunninghamTheme } from '@/cunningham';
1414
import {
1515
Doc,
@@ -24,6 +24,7 @@ import SubPageIcon from './../assets/sub-page-logo.svg';
2424
import { DocTreeItemActions } from './DocTreeItemActions';
2525

2626
const ItemTextCss = css`
27+
font-weight: normal;
2728
overflow: hidden;
2829
text-overflow: ellipsis;
2930
white-space: initial;
@@ -216,27 +217,25 @@ export const DocSubPageItem = (props: TreeViewNodeProps<Doc>) => {
216217
buttonOptionRef={buttonOptionRef}
217218
/>
218219
</Box>
219-
<BoxButton
220+
<StyledLink
221+
href={`/docs/${doc.id}`}
220222
onClick={(e) => {
221223
e.stopPropagation();
224+
e.preventDefault();
222225
handleActivate();
223226
}}
224227
tabIndex={-1}
225-
$width="100%"
226-
$direction="row"
227-
$gap={spacingsTokens['xs']}
228-
$align="center"
229-
$minHeight="24px"
230228
data-testid={`doc-sub-page-item-${doc.id}`}
231229
aria-label={`${t('Open document {{title}}', { title: docTitle })}`}
232230
$css={css`
233-
text-align: left;
234-
min-width: 0;
231+
width: 100%;
235232
`}
236233
>
237234
<Box
238235
$direction="row"
239236
$align="center"
237+
$gap={spacingsTokens['xs']}
238+
$minHeight="24px"
240239
$css={css`
241240
display: flex;
242241
flex-direction: row;
@@ -259,7 +258,7 @@ export const DocSubPageItem = (props: TreeViewNodeProps<Doc>) => {
259258
/>
260259
)}
261260
</Box>
262-
</BoxButton>
261+
</StyledLink>
263262
</TreeViewItem>
264263
</Box>
265264
);

0 commit comments

Comments
 (0)