mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-02 09:59:55 +08:00
chore: update style
This commit is contained in:
@@ -1,15 +1,21 @@
|
|||||||
import { Command } from 'cmdk';
|
import { Command } from 'cmdk';
|
||||||
import { StyledListItem } from './style';
|
import { StyledListItem } from './style';
|
||||||
import Link from 'next/link';
|
|
||||||
import { useModal } from '@/providers/global-modal-provider';
|
import { useModal } from '@/providers/global-modal-provider';
|
||||||
import { AllPagesIcon, FavouritesIcon, TrashIcon } from '@blocksuite/icons';
|
import {
|
||||||
|
AllPagesIcon,
|
||||||
|
FavouritesIcon,
|
||||||
|
TrashIcon,
|
||||||
|
PaperIcon,
|
||||||
|
} from '@blocksuite/icons';
|
||||||
import { useEditor } from '@/providers/editor-provider';
|
import { useEditor } from '@/providers/editor-provider';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
import { useRouter } from 'next/router';
|
||||||
|
|
||||||
export const Results = (props: { query: string }) => {
|
export const Results = (props: { query: string }) => {
|
||||||
const query = props.query;
|
const query = props.query;
|
||||||
const { triggerQuickSearchModal } = useModal();
|
const { triggerQuickSearchModal } = useModal();
|
||||||
const { search, openPage, pageList } = useEditor();
|
const { search, openPage, pageList } = useEditor();
|
||||||
|
const router = useRouter();
|
||||||
const [results, setResults] = useState(new Map<string, string | undefined>());
|
const [results, setResults] = useState(new Map<string, string | undefined>());
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return setResults(search(query));
|
return setResults(search(query));
|
||||||
@@ -34,43 +40,49 @@ export const Results = (props: { query: string }) => {
|
|||||||
}}
|
}}
|
||||||
value={result.title}
|
value={result.title}
|
||||||
>
|
>
|
||||||
<StyledListItem>{result.title}</StyledListItem>
|
<StyledListItem>
|
||||||
|
<PaperIcon />
|
||||||
|
<span>{result.title}</span>
|
||||||
|
</StyledListItem>
|
||||||
</Command.Item>
|
</Command.Item>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</Command.Group>
|
</Command.Group>
|
||||||
<Command.Group heading="Jump to">
|
<Command.Group heading="Jump to">
|
||||||
<Command.Item>
|
<Command.Item
|
||||||
|
value="All pages"
|
||||||
|
onSelect={() => {
|
||||||
|
router.push('/page-list/all');
|
||||||
|
triggerQuickSearchModal();
|
||||||
|
}}
|
||||||
|
>
|
||||||
<StyledListItem>
|
<StyledListItem>
|
||||||
<Link
|
<AllPagesIcon />
|
||||||
href={{ pathname: '/page-list/all' }}
|
<span>All pages</span>
|
||||||
onClick={() => triggerQuickSearchModal()}
|
|
||||||
>
|
|
||||||
<AllPagesIcon />
|
|
||||||
<span> All pages</span>
|
|
||||||
</Link>
|
|
||||||
</StyledListItem>
|
</StyledListItem>
|
||||||
</Command.Item>
|
</Command.Item>
|
||||||
<Command.Item>
|
<Command.Item
|
||||||
|
value="Favourites"
|
||||||
|
onSelect={() => {
|
||||||
|
router.push('/page-list/favorite');
|
||||||
|
triggerQuickSearchModal();
|
||||||
|
}}
|
||||||
|
>
|
||||||
<StyledListItem>
|
<StyledListItem>
|
||||||
<Link
|
<FavouritesIcon />
|
||||||
href={{ pathname: '/page-list/favorite' }}
|
<span>Favourites</span>
|
||||||
onClick={() => triggerQuickSearchModal()}
|
|
||||||
>
|
|
||||||
<FavouritesIcon />
|
|
||||||
<span> Favourites</span>
|
|
||||||
</Link>
|
|
||||||
</StyledListItem>
|
</StyledListItem>
|
||||||
</Command.Item>
|
</Command.Item>
|
||||||
<Command.Item>
|
<Command.Item
|
||||||
|
value="Trash"
|
||||||
|
onSelect={() => {
|
||||||
|
router.push('/page-list/trash');
|
||||||
|
triggerQuickSearchModal();
|
||||||
|
}}
|
||||||
|
>
|
||||||
<StyledListItem>
|
<StyledListItem>
|
||||||
<Link
|
<TrashIcon />
|
||||||
href={{ pathname: '/page-list/trash' }}
|
<span>Trash</span>
|
||||||
onClick={() => triggerQuickSearchModal()}
|
|
||||||
>
|
|
||||||
<TrashIcon />
|
|
||||||
<span> Trash</span>
|
|
||||||
</Link>
|
|
||||||
</StyledListItem>
|
</StyledListItem>
|
||||||
</Command.Item>
|
</Command.Item>
|
||||||
</Command.Group>
|
</Command.Group>
|
||||||
|
|||||||
@@ -11,6 +11,13 @@ export const StyledContent = styled('div')(({ theme }) => {
|
|||||||
letterSpacing: '0.06em',
|
letterSpacing: '0.06em',
|
||||||
'[cmdk-group-heading]': {
|
'[cmdk-group-heading]': {
|
||||||
margin: '5px 16px',
|
margin: '5px 16px',
|
||||||
|
fontSize: theme.font.sm,
|
||||||
|
},
|
||||||
|
'[aria-selected="true"]': {
|
||||||
|
transition: 'background .15s, color .15s',
|
||||||
|
borderRadius: '5px',
|
||||||
|
color: theme.colors.primaryColor,
|
||||||
|
backgroundColor: theme.colors.hoverBackground,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -110,7 +117,7 @@ export const StyledListItem = styled.button(({ theme }) => {
|
|||||||
width: '612px',
|
width: '612px',
|
||||||
height: '32px',
|
height: '32px',
|
||||||
fontSize: theme.font.sm,
|
fontSize: theme.font.sm,
|
||||||
color: theme.colors.popoverColor,
|
color: 'inherit',
|
||||||
paddingLeft: '12px',
|
paddingLeft: '12px',
|
||||||
borderRadius: '5px',
|
borderRadius: '5px',
|
||||||
...displayFlex('flex-start', 'center'),
|
...displayFlex('flex-start', 'center'),
|
||||||
@@ -118,32 +125,5 @@ export const StyledListItem = styled.button(({ theme }) => {
|
|||||||
fontSize: '20px',
|
fontSize: '20px',
|
||||||
marginRight: '12px',
|
marginRight: '12px',
|
||||||
},
|
},
|
||||||
transition: 'background .15s, color .15s',
|
|
||||||
':hover': {
|
|
||||||
color: theme.colors.primaryColor,
|
|
||||||
backgroundColor: theme.colors.hoverBackground,
|
|
||||||
},
|
|
||||||
a: {
|
|
||||||
width: '100%',
|
|
||||||
color: 'inherit',
|
|
||||||
...displayFlex('flex-start', 'center'),
|
|
||||||
':visited': {
|
|
||||||
color: theme.colors.popoverColor,
|
|
||||||
},
|
|
||||||
transition: 'background .15s, color .15s',
|
|
||||||
svg: {
|
|
||||||
fontSize: '20px',
|
|
||||||
color: 'inherit',
|
|
||||||
marginBottom: '2px',
|
|
||||||
},
|
|
||||||
span: {
|
|
||||||
color: 'inherit',
|
|
||||||
margin: '0 12px',
|
|
||||||
lineHeight: '22px',
|
|
||||||
overflow: 'hidden',
|
|
||||||
textOverflow: 'ellipsis',
|
|
||||||
whiteSpace: 'nowrap',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user