chore: rename notFound

This commit is contained in:
JimmFly
2022-12-13 20:03:46 +08:00
parent bf02fd26a6
commit 045747429b
2 changed files with 7 additions and 4 deletions
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
import NoResult from './not-found';
import NotFound from './not-found';
import { Command } from 'cmdk';
import { PageMeta, useEditor } from '@/providers/editor-provider';
@@ -35,7 +35,10 @@ const SearchResult = (props: { query: string }) => {
}
});
return (
<>{resultsPageMeta.length ? renderPages(resultsPageMeta) : <NoResult />}</>
<>
{renderPages(resultsPageMeta)}
{resultsPageMeta.length ? <></> : <NotFound />}
</>
);
};
@@ -1,10 +1,10 @@
import React from 'react';
import { Command, useCommandState } from 'cmdk';
const NoResult = () => {
const NotFound = () => {
const search = useCommandState(state => state.search);
// eslint-disable-next-line react/no-unescaped-entities
return <Command.Empty>No results found for "{search}".</Command.Empty>;
};
export default NoResult;
export default NotFound;