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, RadioControl, RangeControl } from '@wordpress/components' import { GeneralEditComponent } from 'src/block.interfaces'; export const HitItemContentPanel: GeneralEditComponent = ({attributes, setAttributes}) => { const { displayPostContentRadio, excerptLength, listLayout, gridColumns } = attributes const handleChangeGridColumns = useCallback((value) => { setAttributes( { gridColumns: value } ) }, [setAttributes]) const handleChangeContentType = useCallback((value) => { setAttributes( { displayPostContentRadio: value, } ) }, [setAttributes]) return ( { displayPostContentRadio === 'excerpt' && ( setAttributes( { excerptLength: value } ) } min={ 10 } /> ) } { listLayout === 'list' ? null : ( )} ) }