1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/src/apps/stable/features/search/components/SearchSuggestions.tsx

49 lines
1.6 KiB
TypeScript
Raw Normal View History

2024-09-23 12:09:25 -04:00
import React, { FunctionComponent } from 'react';
2024-02-24 12:18:10 -08:00
2024-06-11 00:23:57 +03:00
import Loading from 'components/loading/LoadingComponent';
2025-03-06 18:53:18 +03:00
import { appRouter } from 'components/router/appRouter';
import { useSearchSuggestions } from '../api/useSearchSuggestions';
2024-02-24 12:18:10 -08:00
import globalize from 'lib/globalize';
2025-03-06 18:53:18 +03:00
import LinkButton from 'elements/emby-button/LinkButton';
2024-02-24 12:18:10 -08:00
2025-03-06 18:53:18 +03:00
import 'elements/emby-button/emby-button';
2021-06-07 11:55:01 -04:00
2024-02-24 12:18:10 -08:00
type SearchSuggestionsProps = {
parentId?: string | null;
};
2024-02-24 12:18:10 -08:00
const SearchSuggestions: FunctionComponent<SearchSuggestionsProps> = ({ parentId }) => {
2025-03-06 18:53:18 +03:00
const { data: suggestions, isPending } = useSearchSuggestions(parentId || undefined);
2025-03-06 18:53:18 +03:00
if (isPending) 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'>
2024-02-24 12:18:10 -08:00
{suggestions?.map(item => (
2024-09-23 12:01:38 -04:00
<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;