HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: /var/www/html/wp-content/themes/genesis/lib/js/components/post-class-text-control.js
/**
 * The PostClassTextControl component for use in the Custom Classes panel.
 *
 * @since   3.1.0
 * @package Genesis\JS
 * @author  StudioPress
 * @license GPL-2.0-or-later
 */

/**
 * WordPress dependencies
 */
import { __ } from '@wordpress/i18n';
import { compose } from '@wordpress/compose';
import { select, withSelect, withDispatch } from '@wordpress/data';
import { TextControl } from '@wordpress/components';

/**
 * Internal dependencies
 */
import { newMeta } from '../editor/new-meta.js';

function PostControl( { postClass, onUpdate } ) {
	return (
		<TextControl
			__next40pxDefaultSize
			label={ __( 'Post Class', 'genesis' ) }
			value={ postClass }
			onChange={ ( newClass ) => onUpdate( newClass ) }
		/>
	);
}

export const PostClassTextControl = compose( [
	withSelect( () => {
		return {
			postClass: select( 'core/editor' ).getEditedPostAttribute( 'meta' )._genesis_custom_post_class,
		};
	} ),
	withDispatch( ( dispatch ) => ( {
		onUpdate( newClass ) {
			dispatch( 'core/editor' ).editPost(
				{ meta: newMeta( '_genesis_custom_post_class', newClass ) }
			);
		},
	} ) ),
] )( PostControl );