mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add reusable component
This commit is contained in:
parent
c3b5d50313
commit
cc87ba3859
16 changed files with 512 additions and 5 deletions
36
src/components/common/Media.tsx
Normal file
36
src/components/common/Media.tsx
Normal file
|
@ -0,0 +1,36 @@
|
|||
import { BaseItemKind, ImageType } from '@jellyfin/sdk/lib/generated-client';
|
||||
import React, { FC } from 'react';
|
||||
import Image from './Image';
|
||||
import DefaultIconText from './DefaultIconText';
|
||||
import type { ItemDto } from 'types/itemDto';
|
||||
|
||||
interface MediaProps {
|
||||
item: ItemDto;
|
||||
imgUrl: string | undefined;
|
||||
blurhash: string | undefined;
|
||||
imageType?: ImageType
|
||||
defaultCardImageIcon?: string
|
||||
}
|
||||
|
||||
const Media: FC<MediaProps> = ({
|
||||
item,
|
||||
imgUrl,
|
||||
blurhash,
|
||||
imageType,
|
||||
defaultCardImageIcon
|
||||
}) => {
|
||||
return imgUrl ? (
|
||||
<Image
|
||||
imgUrl={imgUrl}
|
||||
blurhash={blurhash}
|
||||
containImage={item.Type === BaseItemKind.TvChannel || imageType === ImageType.Logo}
|
||||
/>
|
||||
) : (
|
||||
<DefaultIconText
|
||||
item={item}
|
||||
defaultCardImageIcon={defaultCardImageIcon}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default Media;
|
Loading…
Add table
Add a link
Reference in a new issue