import { InnerBlocks, RichText } from '@wordpress/block-editor';

export default function save( { attributes } ) {
	const {
		content,
		textTagName = 'span',
		textLinkUrl = '',
		textLinkTarget = '',
		textLinkRel = '',
	} = attributes;
	const tagName = [ 'span', 'strong', 'em', 'a' ].includes( textTagName ) ? textTagName : 'span';

	return (
		<>
			<RichText.Content
				tagName={ tagName }
				className="axcelersblocks-list-item__text"
				value={ content || '' }
				href={ tagName === 'a' ? textLinkUrl || undefined : undefined }
				target={ tagName === 'a' ? textLinkTarget || undefined : undefined }
				rel={ tagName === 'a' ? textLinkRel || undefined : undefined }
			/>
			<InnerBlocks.Content />
		</>
	);
}
