# learnpress/4.1.6.9/assets/src/apps/js/blocks/template/edit.js

LearnPress – WordPress LMS Plugin for Create and Sell Online Courses, version 4.1.6.9. 43 lines.

- Page: https://pluginprobe.com/plugins/learnpress/4.1.6.9/code/assets/src/apps/js/blocks/template/edit.js
- Raw: https://pluginprobe.com/plugins/learnpress/4.1.6.9/raw/assets/src/apps/js/blocks/template/edit.js
- Modified: 2022-07-27T02:27:30+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/learnpress/4.1.6.9/code/assets/src/apps/js/blocks/template/edit.js#L10-L20`.

```javascript

import { useBlockProps } from '@wordpress/block-editor';
import { Placeholder } from '@wordpress/components';
import { __, sprintf } from '@wordpress/i18n';
import { page } from '@wordpress/icons';

const TEMPLATES = {
	'single-course': {
		title: __( 'LearnPress Single Course Template', 'learnpress' ),
		placeholder: 'single-course',
	},
	'archive-course': {
		title: __( 'LearnPress Course Archive Template', 'learnpress' ),
		placeholder: 'archive-course',
	},
};

export default function Edit( { attributes } ) {
	const blockProps = useBlockProps();
	const templateTitle = TEMPLATES[ attributes.template ]?.title ?? attributes.template;

	return (
		<div { ...blockProps }>
			<Placeholder
				icon={ page }
				label={ templateTitle }
				className="wp-block-learnpress-template__placeholder"
			>
				<div className="wp-block-learnpress-template__placeholder-inner">
					{ sprintf(
						/* translators: %s is the template title */
						__(
							'This is an editor placeholder for the %s. On your store this will be replaced by the template and display with your course image(s), title, price, etc. You can move this placeholder around and add further blocks around it to extend the template.',
							'learnpress'
						),
						templateTitle
					) }
				</div>
			</Placeholder>
		</div>
	);
}

```
