mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix: omit items when quick search items are too long (#1505)
This commit is contained in:
@@ -27,6 +27,11 @@ export const Footer: React.FC<FooterProps> = ({
|
|||||||
const { createPage } = useBlockSuiteWorkspaceHelper(blockSuiteWorkspace);
|
const { createPage } = useBlockSuiteWorkspaceHelper(blockSuiteWorkspace);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { jumpToPage } = useRouterHelper(router);
|
const { jumpToPage } = useRouterHelper(router);
|
||||||
|
const MAX_QUERY_SHOW_LENGTH = 20;
|
||||||
|
const normalizedQuery =
|
||||||
|
query.length > MAX_QUERY_SHOW_LENGTH
|
||||||
|
? query.slice(0, MAX_QUERY_SHOW_LENGTH) + '...'
|
||||||
|
: query;
|
||||||
return (
|
return (
|
||||||
<Command.Item
|
<Command.Item
|
||||||
data-testid="quick-search-add-new-page"
|
data-testid="quick-search-add-new-page"
|
||||||
@@ -52,7 +57,7 @@ export const Footer: React.FC<FooterProps> = ({
|
|||||||
<StyledModalFooterContent>
|
<StyledModalFooterContent>
|
||||||
<PlusIcon />
|
<PlusIcon />
|
||||||
{query ? (
|
{query ? (
|
||||||
<span>{t('New Keyword Page', { query: query })}</span>
|
<span>{t('New Keyword Page', { query: normalizedQuery })}</span>
|
||||||
) : (
|
) : (
|
||||||
<span>{t('New Page')}</span>
|
<span>{t('New Page')}</span>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { displayFlex, styled } from '@affine/component';
|
import { displayFlex, styled, textEllipsis } from '@affine/component';
|
||||||
|
|
||||||
export const StyledContent = styled('div')(({ theme }) => {
|
export const StyledContent = styled('div')(({ theme }) => {
|
||||||
return {
|
return {
|
||||||
@@ -150,6 +150,9 @@ export const StyledListItem = styled('button')(({ theme }) => {
|
|||||||
borderRadius: '5px',
|
borderRadius: '5px',
|
||||||
transition: 'background .15s, color .15s',
|
transition: 'background .15s, color .15s',
|
||||||
...displayFlex('flex-start', 'center'),
|
...displayFlex('flex-start', 'center'),
|
||||||
|
span: {
|
||||||
|
...textEllipsis(1),
|
||||||
|
},
|
||||||
'>svg': {
|
'>svg': {
|
||||||
fontSize: '20px',
|
fontSize: '20px',
|
||||||
marginRight: '12px',
|
marginRight: '12px',
|
||||||
|
|||||||
Reference in New Issue
Block a user