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, } from '@wordpress/components' import { GeneralEditComponent } from '../../block.interfaces'; export const HitItemVisibilityPanel: GeneralEditComponent = ({attributes, setAttributes}) => { const { displayPostDate, displayPostAuthor, displayPostCategory, displayPostTags, isUsingPaidPlan, } = attributes const handleDisplayPostDate = useCallback(() => { setAttributes({ displayPostDate: !displayPostDate }) }, [setAttributes, displayPostDate]) const handleDisplayPostAuthor = useCallback(() => { setAttributes({ displayPostAuthor: !displayPostAuthor }) }, [setAttributes, displayPostAuthor]) const handleDisplayPostCategory = useCallback(() => { setAttributes({ displayPostCategory: !displayPostCategory }) }, [displayPostCategory]) const handleDisplayPostTags = useCallback(() => { setAttributes({ displayPostTags: !displayPostTags }) }, [displayPostTags]) const handlePaidPlanChecker = useCallback(() => { setAttributes({ isUsingPaidPlan: !isUsingPaidPlan }) }, [isUsingPaidPlan]) return ( ) }