mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Move search components and hooks to features
This commit is contained in:
parent
da0cf958d3
commit
a63e80ec46
9 changed files with 20 additions and 22 deletions
|
@ -1,48 +0,0 @@
|
|||
import React, { FunctionComponent } from 'react';
|
||||
|
||||
import Loading from 'components/loading/LoadingComponent';
|
||||
import { appRouter } from '../router/appRouter';
|
||||
import { useSearchSuggestions } from 'hooks/searchHook/useSearchSuggestions';
|
||||
import globalize from 'lib/globalize';
|
||||
import LinkButton from '../../elements/emby-button/LinkButton';
|
||||
|
||||
import '../../elements/emby-button/emby-button';
|
||||
|
||||
type SearchSuggestionsProps = {
|
||||
parentId?: string | null;
|
||||
};
|
||||
|
||||
const SearchSuggestions: FunctionComponent<SearchSuggestionsProps> = ({ parentId }) => {
|
||||
const { isLoading, data: suggestions } = useSearchSuggestions(parentId || undefined);
|
||||
|
||||
if (isLoading) return <Loading />;
|
||||
|
||||
return (
|
||||
<div
|
||||
className='verticalSection searchSuggestions'
|
||||
style={{ textAlign: 'center' }}
|
||||
>
|
||||
<div>
|
||||
<h2 className='sectionTitle padded-left padded-right'>
|
||||
{globalize.translate('Suggestions')}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div className='searchSuggestionsList padded-left padded-right'>
|
||||
{suggestions?.map(item => (
|
||||
<div key={item.Id}>
|
||||
<LinkButton
|
||||
className='button-link'
|
||||
style={{ display: 'inline-block', padding: '0.5em 1em' }}
|
||||
href={appRouter.getRouteUrl(item)}
|
||||
>
|
||||
{item.Name}
|
||||
</LinkButton>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SearchSuggestions;
|
Loading…
Add table
Add a link
Reference in a new issue