mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
use LinkButton in SearchSuggestions
This commit is contained in:
parent
10419dcd48
commit
7011d09b4b
1 changed files with 18 additions and 22 deletions
|
@ -1,17 +1,19 @@
|
|||
import React, { type FC } from 'react';
|
||||
import { useSearchSuggestions } from 'hooks/searchHook';
|
||||
import React, { FunctionComponent, useEffect, useState } from 'react';
|
||||
|
||||
import Loading from 'components/loading/LoadingComponent';
|
||||
import { appRouter } from '../router/appRouter';
|
||||
import globalize from '../../lib/globalize';
|
||||
import LinkButton from 'elements/emby-button/LinkButton';
|
||||
import { useSearchSuggestions } from 'hooks/searchHook/useSearchSuggestions';
|
||||
import globalize from 'lib/globalize';
|
||||
import LinkButton from '../../elements/emby-button/LinkButton';
|
||||
|
||||
import '../../elements/emby-button/emby-button';
|
||||
|
||||
interface SearchSuggestionsProps {
|
||||
parentId?: string;
|
||||
}
|
||||
type SearchSuggestionsProps = {
|
||||
parentId?: string | null;
|
||||
};
|
||||
|
||||
const SearchSuggestions: FC<SearchSuggestionsProps> = ({ parentId }) => {
|
||||
const { isLoading, data: suggestions } = useSearchSuggestions(parentId);
|
||||
const SearchSuggestions: FunctionComponent<SearchSuggestionsProps> = ({ parentId }) => {
|
||||
const { isLoading, data: suggestions } = useSearchSuggestions(parentId || undefined);
|
||||
|
||||
if (isLoading) return <Loading />;
|
||||
|
||||
|
@ -27,19 +29,13 @@ const SearchSuggestions: FC<SearchSuggestionsProps> = ({ parentId }) => {
|
|||
</div>
|
||||
|
||||
<div className='searchSuggestionsList padded-left padded-right'>
|
||||
{suggestions?.map((item) => (
|
||||
<div key={`suggestion-${item.Id}`}>
|
||||
<LinkButton
|
||||
className='button-link'
|
||||
href={appRouter.getRouteUrl(item)}
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
padding: '0.5em 1em'
|
||||
}}
|
||||
>
|
||||
{item.Name}
|
||||
</LinkButton>
|
||||
</div>
|
||||
{suggestions?.map(item => (
|
||||
<LinkButton key={item.Id}
|
||||
className='button-link'
|
||||
style={{ display: 'inline-block', padding: '0.5em 1em' }}
|
||||
href={appRouter.getRouteUrl(item)}>
|
||||
{item.Name}
|
||||
</LinkButton>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue