The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/components/message/content/urlPreviews/OEmbedResolver.tsx

26 lines
670 B

import type { ReactElement } from 'react';
import OEmbedHtmlPreview from './OEmbedHtmlPreview';
import OEmbedImagePreview from './OEmbedImagePreview';
import OEmbedLinkPreview from './OEmbedLinkPreview';
import type { OEmbedPreviewMetadata } from './OEmbedPreviewMetadata';
type OEmbedResolverProps = {
meta: OEmbedPreviewMetadata;
};
const OEmbedResolver = ({ meta }: OEmbedResolverProps): ReactElement | null => {
switch (meta.type) {
case 'rich':
case 'video':
return <OEmbedHtmlPreview {...meta} />;
case 'photo':
return <OEmbedImagePreview {...meta} />;
default:
return <OEmbedLinkPreview {...meta} />;
}
};
export default OEmbedResolver;