Skip to content

Commit ddf1204

Browse files
committed
fixup! ♻️(frontend) refactor DocSearchModalGlobal
Signed-off-by: charles <charles.englebert@protonmail.com>
1 parent 23499ce commit ddf1204

File tree

1 file changed

+60
-1
lines changed
  • src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking

1 file changed

+60
-1
lines changed

src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/SearchPage.tsx

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

12-
import { Box, Card, QuickSearch, QuickSearchGroup, Text } from '@/components';
12+
import {
13+
Box,
14+
Card,
15+
Icon,
16+
QuickSearch,
17+
QuickSearchGroup,
18+
QuickSearchItemContent,
19+
Text,
20+
} from '@/components';
1321
import { useCunninghamTheme } from '@/cunningham';
1422
import {
1523
DocsBlockSchema,
@@ -19,6 +27,7 @@ import {
1927
import AddPageIcon from '@/docs/doc-editor/assets/doc-plus.svg';
2028
import {
2129
Doc,
30+
getEmojiAndTitle,
2231
useCreateChildDocTree,
2332
useDocStore,
2433
useTrans,
@@ -61,6 +70,10 @@ type SearchPageProps = {
6170
contentRef: (node: HTMLElement | null) => void;
6271
};
6372

73+
function FoundPageIcon(props: { width: string; style: { maxHeight: string } }) {
74+
return null;
75+
}
76+
6477
export const SearchPage = ({
6578
contentRef,
6679
trigger,
@@ -250,6 +263,52 @@ export const SearchPage = ({
250263

251264
editor.focus();
252265
}}
266+
renderSearchElement={(doc) => {
267+
const { emoji, titleWithoutEmoji } = getEmojiAndTitle(
268+
doc.title || untitledDocument,
269+
);
270+
271+
return (
272+
<QuickSearchItemContent
273+
left={
274+
<Box
275+
$direction="row"
276+
$gap="0.2rem"
277+
$align="center"
278+
$padding={{ vertical: '0.5rem', horizontal: '0.2rem' }}
279+
$width="100%"
280+
>
281+
<Box
282+
$css={css`
283+
width: 24px;
284+
flex-shrink: 0;
285+
`}
286+
>
287+
{emoji ? (
288+
<Text $size="18px">{emoji}</Text>
289+
) : (
290+
<FoundPageIcon
291+
width="100%"
292+
style={{ maxHeight: '24px' }}
293+
/>
294+
)}
295+
</Box>
296+
297+
<Text
298+
$size="sm"
299+
$color="var(--c--globals--colors--gray-1000)"
300+
spellCheck="false"
301+
>
302+
{titleWithoutEmoji}
303+
</Text>
304+
</Box>
305+
}
306+
right={
307+
<Icon iconName="keyboard_return" spellCheck="false" />
308+
}
309+
/>
310+
);
311+
}}
253312
/>
254313
<QuickSearchGroup
255314
group={{

0 commit comments

Comments
 (0)