lbry-desktop/ui/component/fileProperties/view.jsx

45 lines
1.2 KiB
React
Raw Normal View History

2019-06-11 20:10:58 +02:00
// @flow
2021-04-23 21:59:48 +02:00
import type { Node } from 'react';
import * as ICONS from 'constants/icons';
2019-06-11 20:10:58 +02:00
import * as React from 'react';
2020-01-29 16:26:39 +01:00
import classnames from 'classnames';
2019-06-11 20:10:58 +02:00
import Icon from 'component/common/icon';
import FilePrice from 'component/filePrice';
2019-06-27 22:27:38 +02:00
import VideoDuration from 'component/videoDuration';
2020-01-28 20:52:17 +01:00
import FileType from 'component/fileType';
2019-06-11 20:10:58 +02:00
type Props = {
uri: string,
downloaded: boolean,
claimIsMine: boolean,
isSubscribed: boolean,
2020-01-29 16:26:39 +01:00
small: boolean,
2021-04-23 21:59:48 +02:00
claim: Claim,
properties?: (Claim) => ?Node,
2019-06-11 20:10:58 +02:00
};
export default function FileProperties(props: Props) {
2021-04-23 21:59:48 +02:00
const { uri, downloaded, claimIsMine, isSubscribed, small = false, properties, claim } = props;
2019-06-11 20:10:58 +02:00
return (
<div
className={classnames('file-properties', {
'file-properties--small': small,
})}
>
2021-04-23 21:59:48 +02:00
{typeof properties === 'function' ? (
properties(claim)
) : (
<>
<VideoDuration uri={uri} />
<FileType uri={uri} />
{isSubscribed && <Icon tooltip icon={ICONS.SUBSCRIBE} />}
{!claimIsMine && downloaded && <Icon tooltip icon={ICONS.LIBRARY} />}
2020-05-21 17:38:28 +02:00
2021-04-23 21:59:48 +02:00
<FilePrice hideFree uri={uri} />
</>
)}
2019-06-11 20:10:58 +02:00
</div>
);
}