2019-12-30 20:54:53 +01:00
|
|
|
// @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();
|
2019-12-30 20:54:53 +01:00
|
|
|
const EmbedWrapperPage = (props: Props) => {
|
2020-01-27 22:37:54 +01:00
|
|
|
const { resolveUri, claim, uri } = props;
|
2019-12-30 20:54:53 +01:00
|
|
|
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>
|
|
|
|
);
|
2019-12-30 20:54:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default EmbedWrapperPage;
|