lbry-desktop/ui/page/embedWrapper/view.jsx

32 lines
704 B
React
Raw Normal View History

// @flow
import React, { useEffect } from 'react';
import FileRender from 'component/fileRender';
type Props = {
uri: string,
resolveUri: string => void,
claim: Claim,
};
2020-01-31 19:25:48 +01:00
// $FlowFixMe apparently flow thinks this is wrong.
export const EmbedContext = React.createContext();
const EmbedWrapperPage = (props: Props) => {
2020-01-27 22:37:54 +01:00
const { resolveUri, claim, uri } = props;
useEffect(() => {
if (resolveUri && uri) {
resolveUri(uri);
}
}, []);
2020-01-31 19:25:48 +01:00
return (
<div className={'embed__wrapper'}>
{claim && (
<EmbedContext.Provider value>
<FileRender uri={uri} embedded />
</EmbedContext.Provider>
)}
</div>
);
};
export default EmbedWrapperPage;