mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
feat: add naive client-based search
This commit is contained in:
@@ -8,6 +8,7 @@ import { VscPackage } from 'react-icons/vsc';
|
||||
import { RouterTransition } from '../components/RouterTransition';
|
||||
import '../styles/unocss.css';
|
||||
import '../styles/main.css';
|
||||
import { miniSearch } from '~/util/search';
|
||||
|
||||
const actions: (router: NextRouter) => SpotlightAction[] = (router: NextRouter) => [
|
||||
{
|
||||
@@ -111,7 +112,19 @@ export default function MyApp({ Component, pageProps }: AppProps) {
|
||||
withNormalizeCSS
|
||||
withGlobalStyles
|
||||
>
|
||||
<SpotlightProvider shortcut={['mod + P', 'mod + K', '/']} actions={actions(router)}>
|
||||
<SpotlightProvider
|
||||
shortcut={['mod + P', 'mod + K', '/']}
|
||||
actions={actions(router)}
|
||||
limit={7}
|
||||
filter={(query, actions) => {
|
||||
if (!query) {
|
||||
return actions;
|
||||
}
|
||||
|
||||
const search = miniSearch.search(query);
|
||||
return actions.filter((action) => search.some((res) => res.name === action.title));
|
||||
}}
|
||||
>
|
||||
<RouterTransition />
|
||||
<Component {...pageProps} />
|
||||
</SpotlightProvider>
|
||||
|
||||
Reference in New Issue
Block a user