import React, { useCallback } from 'react' /** * Retrieves the translation of text. * * @see https://developer.wordpress.org/block-editor/packages/packages-i18n/ */ import { __ } from '@wordpress/i18n'; import { PanelBody, ToggleControl, RangeControl } from '@wordpress/components' import { GeneralEditComponent } from '../../block.interfaces'; export const RelatedItemConfiguration: GeneralEditComponent = ({attributes, setAttributes}) => { const { categoryScore, postTitleScore, tagScore, enableExperimentalRelatedItems } = attributes const handleEnableFeature = useCallback(() => { setAttributes({enableExperimentalRelatedItems: !enableExperimentalRelatedItems}) }, [enableExperimentalRelatedItems, setAttributes]) return ( {!enableExperimentalRelatedItems? null: ( <> setAttributes( { postTitleScore: value } ) } min={ 0 } max={ 5 } /> setAttributes( { categoryScore: value } ) } min={ 0 } max={ 5 } /> setAttributes( { tagScore: value } ) } min={ 0 } max={ 5 } /> )} ) }