@wordpress/block-library
Version:
Block library for the WordPress editor.
23 lines (20 loc) • 561 B
JavaScript
import { __ } from '@wordpress/i18n';
import { ChainIcon } from './icons';
/**
* Retrieves the social service's icon component and label.
*
* @param {Object} variation The object of the social service variation.
* @return {Object} An object containing the Icon component for social service and label.
*/
export function getSocialService( variation ) {
if ( ! variation?.name ) {
return {
icon: ChainIcon,
label: __( 'Social Icon' ),
};
}
return {
icon: variation?.icon ?? ChainIcon,
label: variation?.title ?? __( 'Social Icon' ),
};
}