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

49 lines
1.3 KiB
React
Raw Normal View History

// @flow
import React from 'react';
import Button from 'component/button';
2020-05-22 22:47:10 +02:00
import FilePrice from 'component/filePrice';
import { formatLbryUrlForWeb } from 'util/url';
import { withRouter } from 'react-router';
import { URL } from 'config';
2021-07-26 00:03:48 +02:00
import Logo from 'component/logo';
type Props = {
uri: string,
title: ?string,
isInApp: boolean,
};
function FileViewerEmbeddedTitle(props: Props) {
const { uri, title, isInApp } = props;
let contentLink = `${formatLbryUrlForWeb(uri)}`;
if (!isInApp) {
contentLink = `${contentLink}?src=embed`;
}
const contentLinkProps = isInApp ? { navigate: contentLink } : { href: contentLink };
const lbryLinkProps = isInApp ? { navigate: '/' } : { href: URL };
return (
2020-05-22 22:47:10 +02:00
<div className="file-viewer__embedded-header">
<div className="file-viewer__embedded-gradient" />
<Button
label={title}
aria-label={title}
button="link"
className="file-viewer__embedded-title"
{...contentLinkProps}
/>
2020-05-22 22:47:10 +02:00
<div className="file-viewer__embedded-info">
2021-07-26 00:03:48 +02:00
<Button className="file-viewer__overlay-logo" aria-label={__('Home')} {...lbryLinkProps}>
<Logo type={'embed'} />
</Button>
2020-05-26 20:42:44 +02:00
{isInApp && <FilePrice uri={uri} />}
2020-05-22 22:47:10 +02:00
</div>
</div>
);
}
export default withRouter(FileViewerEmbeddedTitle);