import * as React from 'react';

import { BlockSaveProps } from '@wordpress/blocks';

import { EmbedMode, BlockAttributes } from './types';

const Save: React.FC<BlockSaveProps<BlockAttributes>> = ( props: any ) => {
	let embedCode = '';

	switch ( props.attributes.embedMode ) {
		case EmbedMode.Seamless:
			embedCode = props.attributes.seamlessEmbedCode;
			break;
		case EmbedMode.IFrame:
			embedCode = props.attributes.iframeEmbedCode;
			break;
	}

	return (
		<div
			className={ props.className }
			dangerouslySetInnerHTML={ { __html: embedCode } }
		>
		</div>
	);
};

export default Save;
